WordPress.org

Forums

Simple Ajax Chat
[resolved] Username as chat name (4 posts)

  1. Ehsan680
    Member
    Posted 1 year ago #

    Hi
    After selecting "Check this box to require users to be logged in (i.e., registered users) to view and use the chat box." it should not ask name, instead use username of the logged in user. Is there any way to do this...
    Any help will be appreciated
    Thx in advance

    https://wordpress.org/plugins/simple-ajax-chat/

  2. Jeff Starr
    Member
    Plugin Author

    Posted 1 year ago #

    Not currently, yet planned for a future version of the plugin.

  3. eddiebanks
    Member
    Posted 1 year ago #

    Hi, first time i've replied to a wordpress support post but they've helped me ALOT in the past so here goes.

    Navigate to simple-ajax-chat-form.php in the plugin folder, line 103-104 there should be this code:

    <?php } else { ?>
    
    				<fieldset id="sac-user-info">

    Remove the <label> element & change the <input> to the following:
    <input type="hidden" name="sac_name" id="sac_name" value=" <?php $currentuser = wp_get_current_user();echo $currentuser->user_login; ?> " />

    So now you just have the message & submit button, and the chat uses your currently logged in username as the chat username.

    Hope this helps someone one day. Also, thanks for the plugin.

  4. RockOlaZ
    Member
    Posted 1 year ago #

    Should you prefer the display name to be well, displayed, instead of the login

    Change "user_login" to "display_name". Which gives

    <input type="hidden" name="sac_name" id="sac_name" value=" <?php $currentuser = wp_get_current_user();echo $currentuser->display_name; ?> " />

    Thanks to Eddie for his code.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Ajax Chat
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.