I am honestly not remembering, is there a way to tag users in a post or anything like that. Im aware of the hashtags premium component but what Im talking about is doing like @Bryce Alfred for example and that gives a notification to that user that they were mentioned in a post.
If there isnt a component or functionality for this I might work on creating one because I think that would be a cool enhancement
So Arsalan, I am a bit confused. Are you saying I would use @username or would I do something like @Firstname Lastname to reference a user? I guess something I am confused on as well is the UI control for the query after entering the "@" query character. I am a back end Dev by trade so this is going to be new to me. I would think since usernames are hidden from scope to most that I would be using the actual full name not username aka sign-in name. Regarding the query character would say treat it like acronym expansions or searches where you let them enter a few characters and then blow up the search string? For example, I have a user in my userbase called Maxwell Anderson and I type @Ma, nothing comes up but then I type @Max and it injects @Maxwell Anderson. Is that right? What if there are multiple Maxwell's?
Code formatting is fixed , you should be able to format code again. ossn_friend_picker is for picking friends in wall post /tagging, however if you need to do tagging feature you need to see callback for wall post created, and comment created. Example
function my_com_init(){
ossn_register_callback('wall', 'post:created', 'wall_created');
ossn_register_callback('comment', 'created', 'comment_created');
}
function wall_created($callback, $type, $params){
$new_wall_post_id = $params['object_guid'];
$wall_post = ossn_get_object($new_wall_post_$id);
//then go through the object for post and detect @ symbol / usernames and tag and send message to users
}
function comment_created($callback, $type, $params){
//same with comment
}
Other approach should be to find some JS module that tag usernames in specific input element.
I dont know why but the code block formatting isnt working for me so sorry for the poor formatting
So upon looking into it It seems like the method below is where it needs modification but Im not sure how exactly to tap into/overrride this method because I think this is what would need to be done.
The change is in
OssnWall/ossn_com.php
function ossn_friend_picker() {
header('Content-Type: application/json');
if(!ossn_isLoggedin()) {
exit;
}
$user = new OssnUser;
$friends = $user->getFriends(ossn_loggedin_user()->guid);
if(!$friends) {
return false;
}
$search_for = input('q');
// allow case insensitivity with first typed in char
$fc = mb_strtoupper(mb_substr($search_for, 0, 1,'UTF-8'), 'UTF-8');
$search_For = $fc . mb_substr($search_for, 1, null, 'UTF-8');
// show all friends with wildcard '*' in first place
if($search_for == '*') {
$search_for = '';
$search_For = '';
}
$search_len = mb_strlen($search_for,'UTF-8');
foreach($friends as $users) {
$first_name_start = mb_substr($users->first_name, 0, $search_len, 'UTF-8');
if($first_name_start == $search_for || $first_name_start == $search_For) {
$p['first_name'] = $users->first_name;
$p['last_name'] = $users->last_name;
$p['imageurl'] = ossn_site_url("avatar/{$users->username}/smaller");
$p['id'] = $users->guid;
$usera[] = $p;
}
}
echo json_encode($usera);
}
And I think the change would be to swap line 113 from this
$friends = $user->getFriends(ossn_loggedin_user()->guid);
To this
$friends = $user->getSiteUsers(['page_limit' => false]);
Is that correct? If it is, I could use some help on how to properly implement it via a new component so as not to modify the core files.
Thanks!
Bryce
I feel like such an idiot lol, the flippin button is right there to tag friends on the post. I can see your point in that it is a filtered list of only your friends. I wish I knew more about OSSN to know what to override in that search. I know its probably just doing a SQL query on your friends and would be super easy to just remove the line from the WHERE clause or a JOIN to a friends table but I dont want to modify the core files per Arsalan and Z-Mans recommendations. Help me out guys, is there a hook I could tap into here to trigger that search with a different query to the DB and override the default behavior? If there is, I wouldnt mind making a component to open up that query to the user base. I know this isnt something that would be useful for all but it would be useful for me and maybe some others too.
Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.
$199 (Life Time)