Skip Navigation

[Resolved] Problems with accessing / hiding user data in templates

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 10 replies, has 2 voices.

Last updated by Margo van Vegchel 2 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2535347

I use several templates in my website and suddenly not all of those templates seem to function properly anymore.

I'll include the code of a few of those templates

First template has to show the homework for a student if somebody is logged in, hide it if not.

[wpv-conditional if="( '[can_access]' eq '1' )"]
Cursist: [wpv-post-author][has_page id='[wpv-post-author format="meta" meta="ID"]']<br/>
Cursus: [wpv-post-taxonomy type="course-group"] les [types field="lesson-number" format="FIELD_VALUE"][/types]<br/>
<div class="homework-image">[types field="assignment-image" width="800" height="800" align="center" resize="proportional"][/types]</div>
<div class="homework-watched">
Aantal malen bekeken [do_counter]
</div>
<div class="homework-remarks"><h3>Opmerkingen:</h3>[wpv-post-body view_template="None"]</div>
[wpv-conditional if="( $(wpcf-teacher-comments) ne '' )"]<div class="homework-feedback">

<h3>Docentenfeedback:</h3>[types field="teacher-comments"][/types]<br/>
<h4>Waardering: </h4>

  • Compositie : [types field="teacher-composition"][/types]
  • Kleur: [types field="teacher-color"][/types]
  • Textuur: [types field="teacher-texture"][/types]
  • Vorm en lijn: [types field="teacher-shape-and-line"][/types]
  • Originaliteit: [types field="teacher-originality"][/types]
  • Toonwaarde: [types field="teacher-tone-value"][/types]

</div>
[/wpv-conditional]

[video_access post=[wpv-post-id] level='access']
[wpv-conditional if="( $(wpcf-video-comment) ne '' )"]

[wpv-conditional if="( '[video_access post=[wpv-post-id] level='access']' ne '1' )"]
<h3>Bij deze huiswerkopdracht hoort een video bespreking. </h3>
<h4>Je moet een PLUS account hebben om toegang tot de video te krijgen</h4>
[/wpv-conditional]

[wpv-conditional if="( '[video_access post=[wpv-post-id] level='access']' eq '1' )"]
[videoframes src="[types field=video-comment output="raw"][/types]" skin="17" headline_color="#000000" autoplay=0 headline_size="22"]
[/wpv-conditional]
[/wpv-conditional]

<div class="homework-meta">
<label>Trefwoorden: </label>[wpv-post-taxonomy type="assignment-keyword"]<br/>
[go_back label="Terug"]
</div>
[/wpv-conditional]
[wpv-conditional if="( '[can_access]' eq '0' )"]
Het lijkt erop, dat hier niets te zien is...
[/wpv-conditional]

If somebody IS logged in I would expect to see the data, if not the message 'het lijkt erop, dat hier niets te zien is'.

The second template has pretty much the same problem

<div class="wxp-portfolio-image">
[wpv-conditional if="( '[can_access]' eq '1' )"]
[wpv-conditional if="( $(wpcf-image-file) eq '' )"]
[wpv-post-featured-image size="large"]
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-image-file) ne '' )"]

[types field='image-file' size='large' align='none' resize='proportional'][/types]
[/wpv-conditional]
</div>
<div class="wxp-portfolio-description">
[wpv-post-author] Bekijk meer afbeeldingen...<br/>
<p>
[wpv-post-body view_template="None"]
</p>
[/wpv-conditional]
[wpv-conditional if="( '[can_access]' eq '0' )"]
Deze foto bestaat niet, bestaat niet meer of is niet voor u toegankelijk.
[/wpv-conditional]
</div>

I would expect a third template to have a similar problem, but here the content is shown as expected.

<div class="my-user-page">

[wpv-conditional if="( '[can_access]' eq '1' )"]

<div class="user_bio">
[wpv-post-body view_template="None"]
</div>
<div class="profile_picture">
[wpv-post-featured-image size="medium"]
</div>
<div style="clear:both;"></div>
<h2>Mijn vrije werk</h2>
[wpv-view name="User Page Images"]
<div class="wxp-clear-both" style="clear:both;"> </div>
<h2>Mijn cursusresultaat</h2>
[wpv-view name="User homework section"]

[/wpv-conditional]
[wpv-conditional if="( '[can_access]' eq '0' )"]
Deze cursist heeft nog geen eigen pagina aangemaakt, of heeft de toegang tot deze pagina beperkt.
[/wpv-conditional]

</div>

I've changed the two first template in a way that all is visible for everybody right now, but I want to hide certain parts of information for not-logged-in users.

Can you please explain me why two samples do not work?

#2535759

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Based on the conditional statements you shared I see most of the conditional statements are using the custom shortcode with the conditions.

Can you please make sure that those shortcodes are available and does return the correct value and if it does then those shortcodes should be registered at: Toolset => Settings => Frontend Content => Third-party shortcode arguments section.

More info:
=> https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/#checking-custom-shortcodes

#2537851

Thanks for your quick response, but I've tried it the way you suggested, and it still does not work. The problem is that one I get the expected result, the other two times not.

#2537871

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is really strange. Do you have any cache plugin installed ? if yes - can you please disable that for now and check.

if still does not work I will require problem URL where I can see the issue or steps I will have to follow to see the issue and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2539873

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - the wp-admin access details you shared is not working at this end. Can you please send me working admin access details.

I have set the next reply to private which means only you and I have access to it.

#2540333

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - still the admin access details you shared is not working at this end. Could you please send me working admin access details.

I have set the next reply to private which means only you and I have access to it.

#2540417

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm not sure but when I try to load your staging site: hidden link

It redirect me on the production site: hidden link

So - I'm not making any changes yet as it seems I'm not working on staging site but on production. Can you please confirm - should I go ahead and check the issue on your production?

#2540483

Thank you Minesh for your patience.
Indeed the urrl is not good, you must be at: hidden link

Hope it works now, greetings margo

#2540519

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As you can see with the following post: hidden link

The [can_access] shortcode returns 0. Can you please tell me where exactly you added those custom shortcodes?

#2541851

Hi, Thank you fore your question ([can_access] shortcode). My web builder look closly now and find the solution. So it seems that my problem is resolved. Thanks fore your quick responce every time. Greetings Margo

#2541853

My issue is resolved now. Thank you!