Hello everyone. Today, I want to share a feature that can be used as a reward for members ^^! (They can purchase it with their points). This feature is 'User Title Shop'.
Step1. ACP >> Users >> Users & Groups >> Profiles >> Add a new field as follows:
Next, go to the Administrator profile page (/u1) >> Find the field you created earlier >> Edit field value >> right-click on the textarea >> inspect element >> Remember the number highlighted in the image below.
Step2. ACP >> General >> Forum >> Categories & Forums >> Add a new forum. Information about this forum is optional and can be entered at your discretion. (Ex: The forum name can be: User title change logs...)
Go to this forum, start a new topic (optional title, ex: BBcode title...), and remember the topic ID and the forum ID (ex: /f1-, /t100-...)
Step3. Set the permissions for this forum as shown in the image below and save:
(Members are allowed to create topics and post replies. Only administrators can view the posts)
Step4. ACP >> Modules >> Points and reputation >> Points system >> Points management. Set the number of points required to purchase the 'Plain Text' title in the 'per subject' column, and the 'BBcode' title in the 'per message' column >> Save. Ex: -500 or -1000 (must have a minus)
Step5. ACP >> Modules >> HTML & Javascript >> HTML pages management >> Create in advanced mode (HTML)
Title: Optional
Do you wish to use your forum header and footer ? Yes
Content:
- Replace
and
in the code with the numbers remembered from step 2. (Plain text - forum_id, BBcode - topic_id)
- Replace
with the number of points set in the 'per message' column, and
with the number of points set in the 'per subject' column.
- Replace
with the number found after
in step 1, and replace
with the value in
(step 1).
- Submit this HTML page.
NOTE:
- When you need to delete old posts, set the forum's points to 0. After deletion, restore the points to original values. You can set up auto-pruning in the ACP.
- You can customize the input fields for each title according to this post (ex: maxlength,...)
- Fix the issue of automatic bolding of titles in AwesomeBB version:
Add to CSS
** Do not remove the copyright when using this feature.
- Spoiler:
- Feature:
- Automatically deducts points when making a purchase and updates to the member's profile.
- Supports two types of titles: 'plain text' and 'BBcode'.
- Displays the information (name and points) of that member.
Disadvantage:
- WYSIWYG editing mode is not available yet; manual BBcode entry is required.
- The price of the title is fixed.
Step1. ACP >> Users >> Users & Groups >> Profiles >> Add a new field as follows:
Next, go to the Administrator profile page (/u1) >> Find the field you created earlier >> Edit field value >> right-click on the textarea >> inspect element >> Remember the number highlighted in the image below.
Step2. ACP >> General >> Forum >> Categories & Forums >> Add a new forum. Information about this forum is optional and can be entered at your discretion. (Ex: The forum name can be: User title change logs...)
Go to this forum, start a new topic (optional title, ex: BBcode title...), and remember the topic ID and the forum ID (ex: /f1-, /t100-...)
Step3. Set the permissions for this forum as shown in the image below and save:
(Members are allowed to create topics and post replies. Only administrators can view the posts)
Step4. ACP >> Modules >> Points and reputation >> Points system >> Points management. Set the number of points required to purchase the 'Plain Text' title in the 'per subject' column, and the 'BBcode' title in the 'per message' column >> Save. Ex: -500 or -1000 (must have a minus)
Step5. ACP >> Modules >> HTML & Javascript >> HTML pages management >> Create in advanced mode (HTML)
Title: Optional
Do you wish to use your forum header and footer ? Yes
Content:
- Spoiler:
- Code:
<h1>User Title Shop by zest_n</h1><div id="ztabs">
<ul>
<li><a href="#tabs-1">Plain text</a> | </li>
<li><a href="#tabs-2">BBcode</a> | </li>
<li><a href="#tabs-3">Info</a></li>
</ul>
<div id="tabs-1" class="zcontent">Only plain text
<input class="input-subtle" id="zval" name="message" maxlength="50">
<input class="btn btn-default" id="zpurchase" type="submit" name="submit" value="Purchase">
</div>
<div id="tabs-2" class="zcontent">Allow BBCode
<input class="input-subtle" id="bbval" name="message" maxlength="50">
<input class="btn btn-default" id="bbpurchase" type="submit" name="submit" value="Purchase">
</div>
<div id="tabs-3" class="zcontent">
<div class="zinfo">Username: <span class="zusername"></span>
<br />
Points: <span class="zpoint"></span>
<br /><div class="credit">COPYRIGHT</div>
Author: <a href="https://help.forumotion.com/u111611">zest_n</a> <br />
Do not remove the copyright without the author's permission.<br />
We do not support forums that remove copyright.
</div>
<div class="zhelp">Describe your shop
</div>
</div>
</div>
<br /><br />
<style>.credit{border-bottom:1px solid #0095FF;color:#0095FF;font-weight:bold;}
.zinfo span{float:right}.zcontent{line-height:3em;font-size:15px}.zinfo{width:40%;;display:inline-block;position:relative}.zhelp{width:58%;left:60px;float:right;position:relative}#ztabs{background:#FFF;padding:10px;box-shadow:rgba(50,50,93,0.25) 0 2px 5px -1px,rgba(0,0,0,0.3) 0 1px 3px -1px}#ztabs li{list-style:none;display:inline-block;padding:5px;font-size:20px;color:#0095FF}#ztabs ul{border-bottom:1px solid #0095FF}#ztabs a{color:#0095FF}#ztabs a:hover{color:#ffc0cb}ul,ol{margin-left:0!important}
</style>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/ui/1.14.0/jquery-ui.js"></script>
<script>
$(function() {
$("#ztabs").tabs();
});
</script>
<script>
$(function() {
$('.zusername').html(_userdata["username"]);
$('.zpoint').load('/u' + _userdata["user_id"] + ' #field_id-13 .field_uneditable');
$('#zpurchase').click(function() {
if ($('#zval').val().search(/\s|\[\/?(b|i|u|strike|list(=(1|a))?|\*|quote(=".+")?|hr|code|spoiler(=[^\[\]]*)?|hide|table|tr|td|img.+\/img|flash.+\/flash|youtube.+\/youtube|dailymotion.+\/dailymotion|size(=\d+)?|color(=#.{6})?|font(=[^\[\]]*)?|url(=[^\s\[\]]*)?|rand|flipv|fliph|blur|fade|wow|sub|sup|updown|scroll|justify|right|center|left)\]/gi) > -1) {
alert('Only plain text, do not use BBcode');
} else if (Number($('.zpoint').text()) >= 500) {
var f = $('#zval').val();
$.post("/post", {
mode: "newtopic",
f: "forum_id",
subject: "Plain text title",
message: f,
post: "Ok"
}).done(function(p) {
alert('You have successfully purchased!');
}).fail(function() {
alert('Error');
});
$.post("/ajax_profile.forum?jsoncallback=?", {
id: "1",
user: _userdata["user_id"],
active: "1",
content: '[["profile_field_2_1", "[center]' + $('#zval').val() + '[/center]"]]',
tid: $("#qjump input[name='tid']").val()
}, {}, "json").done(function(pp) {
window.location.reload();
}).fail(function() {
alert('Error');
});
}
else {alert('You dont have enough points to purchase the title!')}
});
$('#bbpurchase').click(function() {
if (Number($('.zpoint').text()) >= 1000) {
var x = $('#bbval').val();
$.post("/post", {
mode: "reply",
t: "topic_id",
message: x,
post: "Ok"
}).done(function(b) {
alert('You have successfully purchased!');
}).fail(function() {
alert('Error');
});
$.post("/ajax_profile.forum?jsoncallback=?", {
id: "1",
user: _userdata["user_id"],
active: "1",
content: '[["profile_field_2_1", "[center]' + $('#bbval').val() + '[/center]"]]',
tid: $("#qjump input[name='tid']").val()
}, {}, "json").done(function(bb) {
window.location.reload();
}).fail(function() {
alert('Error');
});
}
else {alert('You dont have enough points to purchase the title!')}
});
});
</script>
- Replace
|
|
- Replace
|
|
- Replace
|
|
|
|
- Submit this HTML page.
NOTE:
- When you need to delete old posts, set the forum's points to 0. After deletion, restore the points to original values. You can set up auto-pruning in the ACP.
- You can customize the input fields for each title according to this post (ex: maxlength,...)
- Fix the issue of automatic bolding of titles in AwesomeBB version:
Add to CSS
- Code:
.post-author-details span{font-weight:normal!important}
- Code:
<script> $(function(){$("label:contains('User Title').remove();});</script>
** Do not remove the copyright when using this feature.
Last edited by zest_n on September 21st 2024, 5:32 pm; edited 1 time in total