We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Personal Member Smileys
Topic Started: Jul 27 2012, 07:36 AM (1,896 Views)
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code Name: Personal Member Smileys

What the code does: This code allows members to have a personal smiley, where they can insert a image URL for the smiley and a tag for the smiley in the two profile fields you create and when they use that tag in their post, the image will appear in its place, just like regular smileys do.

How to use the code: No editing is required to the code.

Create two new profile fields:

Admin CP Posted Image Users & Groups Posted Image Profile Fields

Create a new 1 line text profile field:
Quote:
 
Title: Smiley URL
On Registration: No
Admin Only Edit: No
Show field in topics: Yes
Maximum input length: 200
Create another new 1 line text profile field:
Quote:
 
Title: Smiley Tag
On Registration: No
Admin Only Edit: No
Show field in topics: Yes
Maximum input length: 100

How to install the code:

Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
$('tr[id*="post-"] + tr').each(function() {
var smileyURL = $(this).find('td.c_user dl.user_profile dt:contains(Smiley URL) + dd').text();
var smileyTag = $(this).find('td.c_user dl.user_profile dt:contains(Smiley Tag) + dd').text();

$(this).find('td.c_post').each(function() {
if (smileyTag) {
var regex = new RegExp(smileyTag, 'gi');
$(this).html($(this).html().replace(regex, '<img src="' + smileyURL + '" alt="' + smileyTag + '" />'));
}
});
});

$('dl.user_profile dt:contains(Smiley URL), dl.user_profile dt:contains(Smiley Tag)').next('dd').andSelf().remove();
$('dl.user_profile').hide();
$('dl.user_profile dd + dd.spacer').parent('dl.user_profile').show();
</script>
Edited by Cory, Oct 7 2016, 01:57 AM.
Offline Profile Quote Post Goto Top
 
enias
Member
[ *  * ]
If I want to control that, I guess there isnt problem if I change Admin Only Edit by yes..

Other question can I use any smiley from the web, and cory sorry but I am not sure what it will be placed on smiley tag
it is not working, and all the code appers in the bottom of my board
Edited by enias, Jul 28 2012, 09:37 PM.
Offline Profile Quote Post Goto Top
 
enias
Member
[ *  * ]
Cory please.. it doesnt work!
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Yes, you can make it Admin Only Edit to make it controllable to admins only.

You can use smiley images from the web if you have permission to use them and they probably shouldn't be hot-linked.

Smiley tag can be whatever the user wants to specify to input the image in their post, for example if I specified :cory: as my smiley tag and I inputted :cory: in one of my posts, my smiley would appear in its place.

If the code is appearing as text on your board then it wasn't fully copied, that's certainly a result of missing script tags. I would need to see a link to your board to determine what the issues are.
Offline Profile Quote Post Goto Top
 
enias
Member
[ *  * ]
everything as you said... But it is not working
It is no longer in the board I reinstalled.. but it doesnt work :(
http://s4.zetaboards.com/tvaplus/index/
Edited by enias, Aug 1 2012, 10:48 AM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You apparently created the profile fields twice, possibly by accident. Delete the second Smiley URL and Smiley Tag profile fields, leave the first.
Offline Profile Quote Post Goto Top
 
enias
Member
[ *  * ]
Ready, not sure but I also set not to show in topics, maybe that affeced...

One question.. this would be only one Emoticon? I gues that with the problem of my duplicated tag and url field the answer is answered
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
The field needs to be shown in topics in order for the personal smiley to actually appear in posts. The field itself won't appear, however.

Yes, this version only allows one personal smiley per member.
Offline Profile Quote Post Goto Top
 
enias
Member
[ *  * ]
Ok... yes I was trying to avoid the url and tag to appear in profile, I realized they acually dont... thanks.. Nice Code!! Outstanding!!
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Can it only allow members to have one smiley? Or is there a way to have multiple?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Users may have multiple, but it will require a whole new code. Feel free to request such a code in the proper forum and myself or another coder will probably fulfill it.
Offline Profile Quote Post Goto Top
 
Sree
Member Avatar
Member
[ *  * ]
Great code Cory!
Using this on my board.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply