Announcement

#1 2010-08-03 06:26:49

dmstive
Member
2010-07-30
21

[resolved] Show <div> for guests, access to photos once registered.

Hello,

My goal is to show an image and a couple links, one for "register" one for "login", all inside of a DIV or table until the person is registered. Once a guest registers, they would then automatically have full access without me having to login as admin and alter the group that the user would fall under....

I am able to do this with {if is_a_guest()} in my index.tpl file after {if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}{$PLUGIN_INDEX_CONTENT_BEGIN}{/if}, but the problem is once someone registers, neither the DIV nor the categories or thumbnails are displayed; it continues as if the user is still a guest... My category setting while this occurs is access to Admins, family, friends, contacts... If I leave it to everybody, then both my DIV will show and the category will show underneath in my /photos/index.php file.

Thank you in advance for any assistance, this truly is a wonderful script!

Last edited by dmstive (2010-08-03 06:29:45)

Offline

 

#2 2010-08-04 15:02:42

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

I don't mean to be bumping my post higher as it is relatively still new, but has anyone been able to solve this issue? I've searched the forum and documentation and have the seen the same question asked several times but a clear response is never given...

Is there a developer who may be able to help? My project is being held up severely due to this issue and I would greatly appreciate some help. If there is information I need to provide to clarify the understanding of the issue please let me know and I will do so.

... I'm very nervous about this having invested several hours in the integration and customization of Piwigo... and having seen the same question go unanswered numerous times unless I've overlooked a thread...

Thanks,
Steve

Offline

 

#3 2010-08-04 22:30:34

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Show <div> for guests, access to photos once registered.

is_a_guest() is a php function from the piwigo core and so it isn't available for smarty environment
You should assign the value of this function to smarty variable


{php}
global $page, $user;
$this->assign("IS_GUEST", is_a_guest() );
{/php}

and then {if $IS_GUEST } ...


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#4 2010-08-05 00:07:55

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

Flop,

Thanks for the reply and forgive me for my lack of knowledge in php; which file would I define the variable in? Would it be in template.class.php?

As a side note, will this help produce the results I am looking for? Again, a user who is unregistered should only be able to view my DIV container with its contents; once registered, the DIV should no longer be displayed and the categories should take its place...

Thanks for your help,
Steve

Last edited by dmstive (2010-08-05 00:13:23)

Offline

 

#5 2010-08-05 00:54:09

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

Also, the previous information I provided in terms of {if is_a_guest()}<div>........</div>{/if} seems to be working ok so long as I login to the administrator side, Categories>>Manage>>My Specific Category>> then I have to grant access to specific users... [edit] Also, my category must be set to private for it to work this way...

Why do I have to manually grant access to users? In my case, you have 2 classes of people: unregistered users (guests) and registered users. By default, I want someone who has registered to have access WITHOUT me having to go into administration and grant access manually.

I hope that clarifies the issue.

-Steve

Last edited by dmstive (2010-08-05 01:33:21)

Offline

 

#6 2010-08-05 08:35:46

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Show <div> for guests, access to photos once registered.

I don't have understand but I just wake up so ... Unfortunately, I am leaving for weekend and I will have no Internet where I go


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2010-08-07 17:16:24

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

Ok, can anyone else please offer some assistance regarding this issue?

Offline

 

#8 2010-08-10 17:35:48

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

Up

Offline

 

#9 2010-08-10 18:17:10

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Show <div> for guests, access to photos once registered.

flop25 wrote:

{php}
global $page, $user;
$this->assign("IS_GUEST", is_a_guest() );
{/php}

and then {if $IS_GUEST } your code for unregistred {/if} ...

again use this above in the tpl file

Then I suggest you this : [extension by Eric] UserAdvManager

Last edited by flop25 (2010-08-10 18:18:12)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#10 2010-08-12 03:46:09

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

This actually worked the same as what I had originally...

It does show the DIV only to those that are not registered, but it also shows the photos because they are set to public.

If I set the photos to private, and I load the index page as an unregistered user, the index page functions properly, that is, it shows only the DIV and no photo categories.

Again, what I need is to ONLY show the DIV to guests (unregistered users). They should see ONLY the DIV and none of the photo categories or photos unless they register. Once they register, the DIV should no longer be shown because they no longer are guests...

If I could keep the existing code {if $IS_GUEST }<div> blah blah blah </div>{/if}, and set my photo categories to private, and somehow have registered users be able to view all private categories by default, that would be perfect.

Your thoughts?

Offline

 

#11 2010-08-12 04:02:44

dmstive
Member
2010-07-30
21

Re: [resolved] Show <div> for guests, access to photos once registered.

YES!

I was able to do it! Here is how...

I employed the code you provided me, at the top of the index.tpl file, which was:
{php}
global $page, $user;
$this->assign("IS_GUEST", is_a_guest() );
{/php}

Then, I included the contents of the DIV in the same file (where I wanted it to show up) with the following code:
{if $IS_GUEST }<div> blah blah blah </div>{/if}.

I then created a group called "Registered Users"; I then made all of my categories private; next, to allow access to this group I went to Users>>Groups>>Permissions and converted all of the "forbidden" categories for this group to "authorized"... and finally, the magic button that allowed all new guests to be assigned to this group by default once they register, I clicked "reverse default group property" and voila. I created some test users and now they are automatically assigned to my newly created group called "Registered Users".

Thank you for your help with the code!

~Steve

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact