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:
Locked Topic
[ C ] Certain Topics viewable by Certain Members
Topic Started: Apr 4 2012, 05:39 AM (220 Views)
paradise.engineering
Member Avatar
Lowpoly Workshop Founder
[ *  *  * ]
Zetaboards

I need a Javascript that would make Certain Topics viewable only by 1 Unique Member. If the person viewing is not the Member that it should be, an Error Message will appear.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
(function ($) {
var profile_id = 'PROFILE_ID';

function addTopic(topic_id) {
if (!$('#top_info strong a[href*="/profile/' + profile_id + '"]').length && location.href.indexOf('/topic/' + topic_id + '') !== -1) {
$('div.topic-buttons, #nav li:not(:lt(2)), #foot_links').remove();
$('#fast-reply, select[name="fid"]').closest('form').remove();
$('td.c_topicfoot').closest('tr').remove();
$('title').text('Error');

$('#topic_viewer').replaceWith('<table cellspacing="0" id="error_box"><thead><tr><th>Error:</th></tr></thead><tbody><tr class="generic"><td>You do not have permission to access this topic.<br><small>Error Code: 4:2</small></td></tr></tbody></table><br />');
}
}

addTopic('TOPIC_ID');

})(jQuery);
</script>
Replace the two variations of capitalized text and you can repeat the addTopic line to make more topics viewable only to that member.
Offline Profile Goto Top
 
Eccentric Feline
Member Avatar
梦想
[ *  *  *  *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic