I'm looking for a way to hide the User self-registration sidebar plugin if a user has already logged in via the Login sidebar plugin.
Essentially, I'd like to only show the Login plugin and the option to register via the User self-registration would be a simple 'register' link within the Login plugin.
Is the feasible?
Login + User Self-Register integration?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Login + User Self-Register integration?
Hi!
You could do that with some PHP code and tamper with the plugin files, but it would be nicer to do that with some Smarty magic.
Edit the 'sidebar.tpl' file of your template (copy it from templates/default/ into your template folder, if you don't have that file).
Inside the file you see something like:
This is the code responsible for each sidebar plugin. Now we add a IF-check to suppress a plugin in some case:
Now, when the registration form shall be emitted, but the user is logged in, nothing will be shown there. Only in all other cases, the sdiebar plugin will be shown.
Regards,
Garvin
You could do that with some PHP code and tamper with the plugin files, but it would be nicer to do that with some Smarty magic.
Edit the 'sidebar.tpl' file of your template (copy it from templates/default/ into your template folder, if you don't have that file).
Inside the file you see something like:
Code: Select all
...
{foreach from=$plugindata item=item}
<div class="serendipitySideBarItem container_{$item.class}">
{if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/foreach}
....
Code: Select all
...
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_adduser' AND $is_logged_in}
<!-- void, do nothing -->
{else}
<div class="serendipitySideBarItem container_{$item.class}">
{if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/if}
{/foreach}
....
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Regards,
Garvin
You could try to do that by using the URL. If you check the $smarty.server.REQUEST_URI variable, you can see if that is like "/index.php?/register.html" (or whatever your link points to), and if that is the case, hide a specific plugin.sl4ppy wrote:Is it possible for one plugin to hide/show another plugin?
For instance, say I modified the login plugin so that it has a register link. When that link is selected, only then is the adduser plugin shown.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/