Link Library
How to use PHP in "Link Sub-Field Configuration Table"? (3 posts)

  1. comziz
    Posted 1 year ago #

    I wanto apply the following code to one of my subfields;

    if(is_user_logged_in()){echo '<a href="link to pvt page" target='_blank><i>


    </i></a>';} else{echo '<a href="link to Login page"> login to continue </a>';

    How can I do this? I can put simple HTML codes but php won't work of course.

    The reason I'm trying to achieve this, is to show some of the subfields, only to logged in users.

    If there's another way to do this, any help, suggestions or replies would be greatly appreciated.

    Thanks to all in advance.


  2. Yannick Lefebvre
    Plugin Author

    Posted 1 year ago #

    Hi, Sorry I missed this one. It was not tagged as Link Library. There is currently no option to display fields only based on whether or not a user is logged in.

    I see from your code sample that you may be trying to get users to specify a link to their private page if that are logged in. Do you want users who are not logged in still to be able to submit links?

    I could change the option to display fields from Yes or No, to Yes, No and Logged In. Would take a bit of time to implement but is definitely possible.

  3. comziz
    Posted 1 year ago #

    Yannick Lefebvre,

    Thank you so much for your kind responds.

    Let me tell you my goal;

    You see, I have created some neat tutorial pages for the related links that I am sharing. But I want to share those tutorials only with the members, to make them privileged.

    Therefore my wish is to display those "Tutorial for this site" links only to logged in users.

    Currently I'm using the "Link Notes" field for this, which appears next to the "Link Name".

    Where the note itself (in the link properties) includes the tutorial link and the field option for "Link Notes" is like this to make it clickable;

    - <a href='

    ' target='_blank'><i>(Tutorial)</i></a>

    The reason I'm using "Link Notes" for this is, I couldn't find a way to display "Secondary Web Site" under the "Link Library - Additional Link Parameters"

    So whichever field that I'm using, I'm wishing to find a way to configure it to display only to logged in users. That's why I'm trying to add/pass the above code (my 1st post above) to my "tutorial link" or field attributes.

    If you would have any workaround in your mind, I would be grateful to you.

    I could change the option to display fields from Yes or No, to Yes, No and Logged In. Would take a bit of time to implement but is definitely possible.

    I believe this would help my issue more than enough if I could select display option to "No if not logged in".

    Please do let me know if there's anything that I can help you with, to implement this feature.

    Thank you again so much.

    PS: I don't have anything to do with the visitors being able to post links or not, I encourage them to use our forum. So that's not an issue, since that option is already disabled for all users, except admins.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Link Library
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic