Skip Navigation

[Gelöst] Show a Button only current User/Author

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

The issue here is that the user wanted to show a button to the user who is the author of the post they are viewing.

Solution:

What you can do is to use our conditional shortcode to do this.

This should get you your desired results.

[wpv-conditional if="( '[wpv-current-user]' eq '[wpv-post-author]' )"]
 
Button code goes here
 
[/wpv-conditional]

This support ticket is created vor 6 Jahren, 3 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von SteffenM1628 vor 6 Jahren, 3 Monaten.

Assistiert von: Shane.

Author
Artikel
#1077586

Hey there hope you guys doing good!

Let´s say i have an CPT. And on this single template i want to build in a bootstrap button which triggers a modal.
In this modal a relation-form is inside.

Ok everything is working fine: the button triggers the modal and the form is working. my solution was to use a content template. but i can´t put in visibility queries like in a view.

I want to show this Button in the single template only when the current user is the author of the cpt (like in views but views or only loops).

hope you can help.

cheers

#1077600

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Stephen,

What you can do is to use our conditional shortcode to do this.

This should get you your desired results.

[wpv-conditional if="( '[wpv-current-user]' eq '[wpv-post-author]' )"]

Button code goes here

[/wpv-conditional]


Please try this and let me know if it helps.

Thanks,
Shane

#1077618

hey shane, thanks for your reply.
the content template is not saving. an error appears.

here is the code from the template:

[wpv-conditional if="( '[wpv-current-user]' eq '[wpv-post-author]' )"]
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">Einrichtungen verknüpfen</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">
    
<!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Einrichtungen verbinden</h4>
      </div>
      <div class="modal-body">
        <p>Wähle aus, für welche deiner Einrichtungen dieser Job gilt.</p>
        <div>
          [cred-relationship-form form='jobs-einrichtungen' parent_item='$current']
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">X</button>
      </div>
    </div>

  </div>
</div>
[/wpv-conditional]
#1077654

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Steffen,

Could you let me know what the error you are getting is ?

Thanks,
Shane

#1077659

Transleted to english:
„Not able to save the content template“

#1078479

Hey Shane,

thanks for your help. Tried it today with fresh cache from the browser.

It is working great.

Thanks a lot for your help!

I have to say Toolset is really great but your support is absolutly awesome!

cheers