• Resolved paulipops

    (@paulipops)


    Hi, plugin [front end PM] all working fine on my website, but here is the issue.
    It’s an employment based website, and an employer can search for profiles which produces a list of profiles, click on the profile they want to view and at the top of the profile page there is a link ‘Send user a message’.

    On clicking the link, the profile username is passed as a variable to my messaging page [/messaging/?fepaction=newmessage]….. that part is fine, all working correctly.

    NOW, my problem is (due to my very limited capabilities in php) I want to get that variable into the ‘To’ box.

    Currently, I’m simply using an echo statement at the top of the page which says: ‘Enter username in the ‘TO’ box below: [username from variable $profile_nickname]’….. which is fine, but not very professional as the employer then must type the username into the ‘To’ box.

    I thought this was a simple case of changing the part relevant to the [message_to] in file class-fep-form.php……

    ‘value’ => ‘$profile_nickname’,

    …… but it didn’t work.

    If anyone can advise on how to do this I’d be extremely grateful.
    Thanks
    Paul

    https://wordpress.org/plugins/front-end-pm/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Shamim Hasan

    (@shamim51)

    Thread Starter paulipops

    (@paulipops)

    Hi Shamim,
    Thanks for your reply…. I’m sure it works but my PHP is not that great I’m afraid.

    I have a [send message] link that will appear on a users profile page following a user search and subsequent clicking on the link to the user profile.

    I’m using a plugin called [insert_php] which allows me to write PHP code directly onto any page…. my whole user search facility is built this way.

    So, on the user page I currently have….

    [insert_php]

    Some PHP code to get the nickname from the wordpress database of the user profile being viewed and to check that the profile being viewed is not their own profile

    if($profile_id != $user_ID)
    {
    echo “Send user a message“;
    }

    A bit more php code

    [/insert_php]

    So, that’s what I’m currently doing, which is fine, and then on the [messaging/?fepaction=newmessage] page I simply use $_GET to retrieve the profile nickname which is then displayed in a statement telling the user to copy/paste it into the ‘To’ box.

    Reading the threads in the links you sent me, I’m guessing I need to replace my link above with….

    USER ) ); ?>”>Send Message

    Unfortunately my PHP is a little amateurish. I tried cutting and pasting and altering the parenthesis… but I can’t get it to work without errors. Please can you let me know how I get that into my [IF] statement above?

    ALSO, do I need to change the word [USER] to my variable that contains the user nickname [$profile_nickname] or is that some magical word that does it all for me:)?? Sorry if these questions are obvious.

    Many thanks for your help
    Paul

    Thread Starter paulipops

    (@paulipops)

    The link in the current [if] statement should have read…

    [tags removed]
    href=’myhomepageURL/messaging/?fepaction=newmessage&profile_nickname=$profile_nickname’>Send user a message

    And the replacement link should have read…

    [tags removed]
    href=”<?php echo fep_query_url(‘newmessage’, array(‘to’ => USER ) ); ?>”>Send Message

    Thread Starter paulipops

    (@paulipops)

    Ignore me… all sorted!

    I kept my link exactly the same as my original, but changed this part…

    messaging/?fepaction=newmessage&to=$profile_nickname

    … where $profile_nickname is my variable with the nickname of the profile being viewed.

    Strange thing is, I tried this before but for some reason it didn’t work… so must have entered a typo error:(

    Anyway, all sorted, many thanks

    Cheers
    Paul

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Pass username via variable into the 'To' box’ is closed to new replies.