Support Forum

Member List Member URL Display – can it be displayed as Icon?

RR Rebecca Rasmussen
Rebecca Rasmussen
Member

WordPress 3.5.1

SimplePress 5.2.6

SimplePress Theme – Default 1.2.2

Question about the Member List, Member URL screen. Currently the url is showing as linked text and it can get sloppy if it’s a long url. I’d prefer it show as an icon. I have under profile / profile options / website link set to icon, but that only seems to affect the user info displayed to the left of the post content. I’ve tried different themes, but don’t know if it’s not theme controlled or all the themes just happen to treat it the same way but there’s no difference theme to theme (deafult, css only, iforum, stacked).

Is it possible to make the “Member URL” listing “Member URL” value display a linked icon vs. linked text? And if so, which setting do I change or which file do I modify?

:0)

 post_sidebar.jpg

 

member_url.jpg

6 Answers

New Answer

MP Mr Papa
Mr Papa
Member

yes, its possible, but not view simple options or settings…

the entire html for the website url is available with the filter ‘sph_MemberListUrl’… so you could add a filter and replace the html for the link with an icon and the link… would take a little bit of regex to accomplish…

or alternatively, you could take our sp_MemberListUrl() template function, change the name, add it to your spFunctions.php theme template file and tweak the html output to give you what you want…

perhaps we can add this to our list for future consideration…. but its the first time anyone has asked for it…

RR Rebecca Rasmussen
Rebecca Rasmussen
Member

member_url_modified.jpg

Awesome, thanks, that pointed me in just the right direction for the desired hack. Now working! While a core option setting would be great in the future, this hack will certainly work for now. :0)  for others who might be interested in the hack … 

FROM CORE FILES SIMPLE PRESS version 5.2.6
IN FILE simple-press\forum\content\sp-member-view-functions.php
COPY lines 432-482, or the sp_MemberListUrl() function if you’ve changed other things in that file and line numbers are different

PASTE TO THEME in my case NAME Default VERSION 1.2.2
IN FILE sp-resources\forum-themes\default\templates\spFunctions.php
PLACE wherever, I put at end
CHANGE function name as desired, I went with my_sp_MemberListUrl()
ADDED lines in the $defs array

‘showAs’ => ‘text’,
‘icon’ => ‘sp_UserWebsite.png’,
‘iconClass’ => ‘spImg’,
‘targetNew’ => 1,
‘noFollow’ => 0,

//ADDED lines in the “sanitize before use” section

$icon = sanitize_file_name($icon);
$iconClass = esc_attr($iconClass);
$targetNew = (int) $targetNew;
$noFollow = (int) $noFollow; 

ADDED logic to check showAs value, output as text vs. icon as appropriate

if ($showAs == ‘icon’ && $spThisMember->user_url != ”)
{

$target = ($targetNew) ? ‘ target=”_blank”‘ : ”;

$follow = ($noFollow) ? ‘ rel=”nofollow”‘ : ”;
if(!empty($icon)) {

$out = “<div id=’$tagId’ class=’$tagClass’>”;
$out.= “<span class=’$labelClass’>”.sp_filter_title_display($label).”$att</span>”;
$out.= “<a id=’$tagId’ class=’$tagClass vtip’ href=’$spThisMember->user_url’ title=’$spThisMember->user_url’$target$follow><img class=’$iconClass’ src='”.SPTHEMEICONSURL.$icon.”‘ alt=” /></a>n”;
$out.= “</div>n”;

}
$out = apply_filters(‘sph_PostIndexUserWebsite’, $out, $a);

}
else
{

// these were the original 5 lines
$out = “<div id=’$tagId’ class=’$tagClass’>”;
$out.= “<span class=’$labelClass’>”.sp_filter_title_display($label).”$att</span>”;
$out.= “<span class=’$dateClass’>”.sp_make_clickable($spThisMember->user_url).'</span>’;
$out.= “</div>n”;
$out = apply_filters(‘sph_MemberListUrl’, $out, $a);

}

 

IN FILE sp-resources\forum-themes\default\templates\spMembersView.php
CHANGE call to core MemberListUrl to instead call modified one just added
AND PASS in the showAs value as “icon”

# Column 6 of the member row – url
# ———————————————————————-
sp_ColumnStart(‘tagClass=spColumnSection spRight&width=26%’);
//sp_MemberListUrl(”, __sp(‘Member URL’));
my_sp_MemberListUrl(array(‘showAs’ => ‘icon’), __sp(‘Member URL’));
sp_ColumnEnd();

MP Mr Papa
Mr Papa
Member

yup, perfect example of my #2 suggestion…  good job!

since you did all the work, I might be able to add it in for the next release… no promises though… ;)

MP Mr Papa
Mr Papa
Member

thanks! have added to SP 5.3 – although slightly optimized… ;)