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

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

    After:

    </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.

    https://www.ads-software.com/plugins/link-library/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Yannick Lefebvre

    (@jackdewey)

    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.

    Thread Starter comziz

    (@comziz)

    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;

    Before:
    - <a href='

    After:
    ' 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use PHP in "Link Sub-Field Configuration Table"?’ is closed to new replies.