HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

How do you add users to a new user's friend list?

This discussion is related to the Friendships addon.

Thank you for this plugin! It's awesome. I feel like the empty friendly that you see when you have no friends is kind of ugly in terms of css, so I thought why not add some default users like a moderator and admin to every new user's friendly? The problem is I don't know how to :dizzy: If I were to try this then I would probably modify the plugin to insert the hardcoded usernames into the friendlist, but I know that's not the right way to do it, so how would I do this the proper way without altering files?

Comments

  • hgtonighthgtonight ∞ · New Moderator

    This got caught in the SPAM filter.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Ah! No wonder it never showed up...Basically I am wondering if it's possible to auto-insert a group of people into every new user's friend list. This way a user has friends by default.

  • RiverRiver MVP
    edited July 2016

    @okhawaja said:

    I feel like the empty friendly that you see when you have no friends is kind of ugly in terms of css,

    Basically I am wondering if it's possible to auto-insert a group of people into every new user's friend list. This way a user has friends by default.

    better to add a definition in conf/config.php or add message or pocket instead of modifying add-on or adding names to db.

    $Definition['Friends list'] = "friends of Admin and Moderator";

    or
    $Definition['Friends list'] ="";

    or just create a message panel that has admin and moderator picture in it and place it directly below the friendship module.

    see for definitions

    https://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale

    see module sorting

    https://vanillaforums.org/discussion/comment/232501/#Comment_232501

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

    okhawaja
  • When I first signed up on MySpace or some other social website, by default 1-2 people were in my friendslist and they sent me an auto pm. I'd like to do the same thing for my site where a new user has atleast 1-3 default users in their friendlist.

  • R_JR_J Ex-Fanboy Munich Moderator

    You could write a plugin that uses an event which is fired after a user has registered . When that event is fired you have to insert one or more rows into GDN_Friendship. The code below should work (but it is untested)

    public function userModel_afterInsertUser_handler($sender, $args) {
        Gdn::sql()->insert(
            'Friendship', 
            array(
                'RequestedBy' => Your Admin ID, // Change that!!!!
                'RequestedTo' => $args['InsertUserID'],
                'RequestedOn' => Gdn_Format::toDateTime()
            )
        );
    }
    


    Caylus
Sign In or Register to comment.