Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Support request] Error in SwpmMemberUtils

Simple Membership Plugin › Forums › Simple Membership Plugin › Error in SwpmMemberUtils

  • This topic has 4 replies, 4 voices, and was last updated 7 years, 1 month ago by The Assurer.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • October 10, 2019 at 10:15 am #19081
    Anonymous
    Inactive

    Hello,
    I use the following code to check if a member is logged in or not,

    <?php if(SwpmMemberUtils::is_member_logged_in()) { ?>

    But I receive this error when I refresh the site: (I inserted … instead of site and some directories name to be shorter)

    Fatal error: Uncaught Error: Class ‘pmMemberUtils’ not found in /home/…(THE FILE THAT I ADD THIS CODE)… Stack trace: #0 /home/…/public_html/wp-includes/template.php(724): require() #1 /home/…/public_html/wp-includes/template.php(671): load_template(‘/home/…, false) #2 /home/…/public_html/wp-includes/general-template.php(168): locate_template(Array, true, false) #3 /home/…/public_html/wp-content/themes/…/index.php(24): get_template_part(‘template-parts/…’) #4 /home/…/public_html/wp-includes/template-loader.php(78): include(‘/home/…) #5 /home/…/public_html/wp-blog-header.php(19): require_once(‘/home/…) #6 /home/…/public_html/index.php(17): require(‘/home/…) #7 {main} thrown in /home/…/public_html/wp-content/themes/….php on line 8

    October 10, 2019 at 11:58 am #19082
    mbrsolution
    Moderator

    Hi, your code is wrong. Please try the following code. Let me know how you go.

    <?php if(SwpmMemberUtils::is_member_logged_in()) { ?>
    //Your message for logged-in members goes here
    <?php } ?>

    Thank you

    October 10, 2019 at 4:24 pm #19083
    Anonymous
    Inactive

    Sorry, I did not write complete my code.
    My code have exactly the same structure that you said. but I receive the above error.

    October 11, 2019 at 1:14 am #19086
    admin
    Keymaster

    Troubleshooting custom code is not something we can look at here (it is beyond the scope of this free support forum). From looking at the error, I can see that the custom script is trying to reference the following class:

    
    pmMemberUtils
    

    That will be an issue since the name of the full class is “SwpmMemberUtils”. So you should check your code to make sure there is no unwanted empty space characters or hidden line breaks in your code (something that got introduced from the copy & paste operation)

    October 12, 2019 at 12:10 am #19087
    The Assurer
    Moderator

    It “might help” if you told us the super-secret file names used in your paths. Any files that define classes must be parsed first, before they can be invoked. As a debugging aid, maybe you can do a ckass_exists() test in the code as a breakpoint?

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy