• Resolved akhilmr

    (@akhilmr)


    Hi,

    I need to check a member is logined or not. I used sf_memberonly(‘[memberonly]’) this function to check but getting error result like ‘PHP Fatal error: Uncaught Error: Call to undefined function sf_memberonly()’.We are using genesis theme.Please helps to fix this issue.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author MembershipWorks

    (@sourcefound)

    Hi akhilmr!

    If you do have the MembershipWorks plugin installed and active, then most likely the error is because you’re calling the function before the plugins have loaded. You need to run your function after plugins_loaded hook or later.

    Thread Starter akhilmr

    (@akhilmr)

    Dear author,

    Thankyou for your reply.How to check if the plugin is loaded?

    Plugin Author MembershipWorks

    (@sourcefound)

    Hi akhilmr!

    You should be able to see your plugins in WordPress under the Plugins > Installed Plugins.

    Note that the sf_memberonly(‘[memberonly]’) method only works if you are using MembershipWorks to manage your members. It is not a general method that is usable for any other membership plugin. In addition this method appears to be from a old support thread from 2016, it no longer works with the current versions of the MembershipWorks plugin. The equivalent function now is sf_shortcode(‘[memberonly]’);

    Thread Starter akhilmr

    (@akhilmr)

    Dear author,

    Thank you for your support.My aim is very simple.I want to hide some contents in the template files by using this above function. We are using bbpress plugin, need to hide all the contents in the plugin pages and files because it is accessible to specific Member folders.Can you please route me make it as possible or not?.

    I tried like this

    $response_results=sf_shortcode(‘[memberonly]’);

    How can i check with the result value of ‘$response_results’.When check with the above function iam getting like below if he/she not logined.

    <span class=”memberonly”>The following content is accessible for members only, please sign in.</span>

    Plugin Author MembershipWorks

    (@sourcefound)

    Hi akhilmr!

    If the $response_results is blank you can give access. If the $response_results is not empty access should be prohibited.

    Thread Starter akhilmr

    (@akhilmr)

    Dear author,

    It is working properly.When logined as wordpress administrator,then logined in membership form,it is not working properly ,the message is getting like ‘administrator notice’.I don’t know why it is haappening?Also i wanto ask a question that why these details are not given in the official documentaion.

    Plugin Author MembershipWorks

    (@sourcefound)

    Hi akhilmr!

    If you are signed in as an administrator you do not meet the criteria as a member. So technically you are not permitted access. You should use a different browser where you are not signed in for testing.

    The use of sf_shortcode(‘[memberonly]’) is not documented and is not officially supported. This information is provided on the basis that use of this function is as-is. Since it is not supported it is also subject to change without notice. There are no documented or supported functions in PHP to check if a member is signed in.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘To check Member is logined’ is closed to new replies.