• Resolved guix69

    (@guix69)


    Hello,
    I have created a custom post type with ACF and inside this CPT I would like to have the ability to insert a person whose infos are managed with the Connections plugin.
    On the frontend the person’s name (visible in the CPT content) would be a link to the person’s details.
    Is it possible and if yes how can I do that? (we’re using the pro version).
    Thank you
    G.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Steven

    (@shazahm1hotmailcom)

    Ther is an undocumented shortcode you could use to embed a directory entry in your CPT content.

    Example:

    • [cn-entry id=n]

    Change the n to the directory entry ID that can be found on the Connections Manage admin page.

    I hope this helps; please let me know.

    Thread Starter guix69

    (@guix69)

    Hello Steven,
    Thanks for the tip but that’s not what I need ?? (Unless I can add a select for a directory entry in the CPT I have built).

    I have a CPT and using the edit screen of the CPT I need to be able to select a person (a directory entry) so that when I display the CPT I can also display a link to that person’s details.
    Or maybe I can select a wordpress user in the CPT and find the directory entry via the email of the selected person…
    I hope I’m being clear.
    Thanks
    G.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    When you use the [cn-entry id=n] shortcode, you are selecting a directory entry to display in your CPT content. The id attribute is how you choose which directory entry. The directory entry id can be found on the Connections Manage admin page.

    When you display that directory entry in your CPT content, the entry name will be a link to the entry detail/profile page in the directory.

    I hope this helps.

    Thread Starter guix69

    (@guix69)

    Thank you for the details, that’s what I understood from your first reply.
    The problem is, how/when do I input in my CPT the id of the entry I want?
    I mean, the entries of my CPT are created by people with no knowledge of the admin so if there is no field allowing the selection of a directory entry, that’s a problem.
    I saw that every entry is linked to a wordpress user through it’s email address.
    Is there maybe a php function to get an entry with a specific email address? This way I could input a user inside my CPT and from there reach the entry.

    Thread Starter guix69

    (@guix69)

    Could you also tell me more about the “link wordpress user” metabox which can be found on an entry edit screen?
    When I start to type a username in this box nothing happens, although an ajax request is sent to the admin (and comes back with a blank response).
    Thanks

    Plugin Author Steven

    (@shazahm1hotmailcom)

    RE: the entries of my CPT are created by people with no knowledge of the admin so if there is no field allowing the selection of a directory entry, that’s a problem.

    I see; sorry, it was not clear that the users adding the Entry shortcode would not have access to the directory admin pages. Honestly, I was assuming you were creating the CPT pages.

    RE: Is there maybe a php function to get an entry with a specific email address?

    Sorry, no, but perhaps there is something close.

    Connections_Link::getLinkedEntry( $user );

    The $user parameter should be supplied as an instance of the WP_User object.

    It will return either false on failure or an instance of the cnEntry object. The false means the WP_User does not have a “linked” directory entry. The cnEntry object would be the directory entry linked to the WP User.

    RE: Could you also tell me more about the “link wordpress user” metabox which can be found on an entry edit screen?

    Add a new WP User. Next, add a new Directory Entry. Start typing the new WP Users Username or Email. After three characters are typed, an autosuggestion list will be displayed. The autosuggestion will be WP Users who start with the characters entered into the field AND are not already linked to another directory entry.

    I hope this helps; please let me know.

    Thread Starter guix69

    (@guix69)

    Hello Steven,
    Thank you for your reply. I managed to use the function you suggested. I also dug a little into the code and found some useful informations ??

    Have a nice day
    Guillaume

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Great to hear this has helped you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘link in custom type created with ACF’ is closed to new replies.