Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
781 views
in Plugins by
how to load a plugin only for logged in users ?
by
if you wish, please tell the name the name of your plugin, I can do it for you..
by
edited by
+1
You may want to pay attention to the file q2apro-sceditor-layer.php and the function called head_script().

Just in case, you're not familiar with.

function head_script(){
if (qa_is_logged_in())
{all original codes here;}
}
by
I don't know what's he wanting to do.If the SCEditor don't load for non-logged users, It will not load the default editor until the core programming is not set as it..
by
It will show nothing for non-logged users
by
+1
I think he cares about pagespeed.

Normally, in a Q2A site, only logged users can post or answer. So, if .the SCEditor don't load for non-logged users, it doesn't matter.
by
I want to boost the page speed for non-logged users. when I am checking the source code of my website it is loading sce-editor for non-logged users.
by
right teddydoors
by
Beware that SCeditor code interferes that Q2A core,  you may want to adjust alittle bit.

Maybe like this


function head_script(){
if (qa_is_logged_in())
{all original codes here;}

else {
qa_html_theme_base::head_script();
}

}
by
reshown by
I can't find any sceditor output that is created after answering question is turned off for non-loged users.Would you tell where have you found it?
by
the editor is belongs to the answer form.So the form will not be loaded the editor won't be loaded too..
by
@teddydoors yeah it will prevent the js from loading
by
function head_script(){
if (qa_is_logged_in())
{all original codes here;}

else {
qa_html_theme_base::head_script();
}

}

This works thanks teddydoors

1 Answer

0 votes
by

You have to edit the source code of the plugin if the plugin developer does not provide you with ready-made options.

if (qa_is_logged_in())  {

Your main plugin content here;

}

by
In qa-theme ?
by
I tried this in qa-plugin but does't work
by
When you asked "In qa-theme ?", I think something is not right. You have to edit the main content of your plugin.

Typically, a plugin is a folder with two files. One of them (qa-plugin.php) is to register that plugin to Q2A system. The other one is the main value of your plugin. You need to edit that file and check out which functions may output the final results.

Sometimes a plugin is merely to override the layout, sometimes a plugin is to output a widget.
...