(2017-12-15, 05:13 PM)Sokrates Wrote: It looks like the thankyoulike.css stylesheet is attached to the showthread.php file, but it's added / modified through themes. Should the code be added/modified through showthread.css or global.css?
I had a look at thankyoulike.php an it looks like it's the
function thankyoulike_install() that creates thankyoulike.css.
// Insert Template elements
$templateset = array(
"prefix" => "thankyoulike",
"title" => "Thank You/Like",
);
$db->insert_query("templategroups", $templateset);
$tyl_templates = array(
'thankyoulike_postbit' => "<div class=\"post_controls tyllist {\$unapproved_shade}\">
{\$tyl_expcol}
<span id=\"tyl_title_{\$post['pid']}\" style=\"{\$tyl_title_display}\">{\$lang->tyl_title}</span><span id=\"tyl_title_collapsed_{\$post['pid']}\" style=\"{\$tyl_title_display_collapsed}\">{\$lang->tyl_title_collapsed}</span><br />
<span id=\"tyl_data_{\$post['pid']}\" style=\"{\$tyl_data_display}\"> • {\$post['thankyoulike']}</span>
</div>",
'thankyoulike_postbit_classic' => "<div class=\"post_controls tyllist_classic {\$unapproved_shade}\">
{\$tyl_expcol}
<span id=\"tyl_title_{\$post['pid']}\" style=\"{\$tyl_title_display}\">{\$lang->tyl_title}</span><span id=\"tyl_title_collapsed_{\$post['pid']}\" style=\"{\$tyl_title_display_collapsed}\">{\$lang->tyl_title_collapsed}</span><br />
<span id=\"tyl_data_{\$post['pid']}\" style=\"{\$tyl_data_display}\"> • {\$post['thankyoulike']}</span>
</div>",
'thankyoulike_expcollapse' => "<a href=\"javascript:void(0)\" onclick=\"thankyoulike.tgl({\$post['pid']});return false;\" title=\"{\$tyl_showhide}\" id=\"tyl_a_expcol_{\$post['pid']}\"><img src=\"{\$theme['imgdir']}/{\$tyl_expcolimg}\" alt=\"{\$tyl_showhide}\" id=\"tyl_i_expcol_{\$post['pid']}\" /></a> ",
'thankyoulike_button_add' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"add_tyl_button\" href=\"thankyoulike.php?action=add&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.add({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->add_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->add_tyl}</span></a></div>",
'thankyoulike_button_del' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"del_tyl_button\" href=\"thankyoulike.php?action=del&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.del({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->del_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->del_tyl}</span></a></div>",
'thankyoulike_users' => "<span class=\"smalltext\">{\$comma}</span><a href=\"{\$profile_link}\" class=\"smalltext\" {\$datedisplay_title}>{\$tyl_list}</a>{\$datedisplay_next}",
'thankyoulike_postbit_author_user' => "{\$lang->tyl_rcvd}: {\$post['tyl_unumrtyls']}
<br />
{\$lang->tyl_given}: {\$post['tyl_unumtyls']}",
'thankyoulike_member_profile' => "<tr>
<td class=\"trow1\"><strong>{\$lang->tyl_total_tyls_rcvd}</strong></td>
<td class=\"trow1\">{\$memprofile['tyl_unumrcvtyls']} ({\$tylrcvpd_percent_total})<br /><span class=\"smalltext\">(<a href=\"tylsearch.php?action=usertylforthreads&uid={\$uid}\">{\$lang->tyl_find_threads_for}</a> — <a href=\"tylsearch.php?action=usertylforposts&uid={\$uid}\">{\$lang->tyl_find_posts_for}</a>)</span></td>
</tr>
<tr>
<td class=\"trow2\"><strong>{\$lang->tyl_total_tyls_given}</strong></td>
<td class=\"trow2\">{\$memprofile['tyl_unumtyls']} ({\$tylpd_percent_total})<br /><span class=\"smalltext\">(<a href=\"tylsearch.php?action=usertylthreads&uid={\$uid}\">{\$lang->tyl_find_threads}</a> — <a href=\"tylsearch.php?action=usertylposts&uid={\$uid}\">{\$lang->tyl_find_posts}</a>)</span></td>
</tr>"
);
foreach($tyl_templates as $template_title => $template_data)
{
$insert_templates = array(
'title' => $db->escape_string($template_title),
'template' => $db->escape_string($template_data),
'sid' => "-2",
'version' => $info['intver'],
'dateline' => TIME_NOW
);
$db->insert_query('templates', $insert_templates);
}
// css-class for thankyoulike
$css = array(
"name" => "thankyoulike.css",
"tid" => 1,
"attachedto" => "showthread.php",
"stylesheet" => "div[id^=tyl_btn_] {
display: inline-block;
}
It seams that the templates are inserted to the database, which make sense. I guess the malfunction is due what is stored in some fields in the database.
I looked into the html-code that comes to the web browser. This is a simplified version:
- - -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- start: showthread -->
<html xml:lang="sv" lang="sv" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme2/global.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/star_ratings.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/showthread.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/css3.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/ncode/xpserkan.css" />
</head>
<body>
<div class="post_controls">
<div class="postbit_buttons author_buttons float_left">
<!-- start: postbit_pm -->
<a href="private.php?action=send&uid=2" title="Send this user a private message" class="postbit_pm"><span>PM</span></a>
<!-- end: postbit_pm --><!-- start: postbit_www -->
<a href="http://manssonslatadagar.blogspot.se/" target="_blank" rel="noopener" title="Visit this user's website" class="postbit_website"><span>Webbplats</span></a>
<!-- end: postbit_www --><!-- start: postbit_find -->
<a href="search.php?action=finduser&uid=2" title="Find all posts by this user" class="postbit_find"><span>Hitta</span></a>
<!-- end: postbit_find --><!-- start: postbit_rep_button -->
<a href="javascript:void(0)" onclick="MyBB.reputation(2,1262); return false;" title="Give Reputation to this user" class="postbit_reputation_add"><span>Betygsätt</span></a>
<!-- end: postbit_rep_button -->
</div>
<div class="postbit_buttons post_management_buttons float_right">
<!-- start: thankyoulike_button_del -->
<div id="tyl_btn_1262" class="postbit_buttons"><a
class="del_tyl_button" href="thankyoulike.php?action=del&pid=1262&my_post_key=185975bba8a0d13c8be182cd1fbb2399" onclick="thankyoulike.del(1262, 319); return false;" title="Ta bort tack skall du ha från detta inlägg" id="tyl_a1262"><span id="tyl_i1262">Ta bort tack</span></a>
</div>
<!-- end: thankyoulike_button_del --><!-- start: postbit_quote -->
<a href="newreply.php?tid=319&replyto=1262" title="Quote this message in a reply" class="postbit_quote"><span>Svara</span></a>
<!-- end: postbit_quote --><!-- start: postbit_multiquote -->
<a href="javascript:void(0)" onclick="Thread.multiQuote(1262); return false;" style="display: none;" id="multiquote_link_1262" title="Quote this post" class="postbit_multiquote"><span id="multiquote_1262">Citera</span></a>
<script type="text/javascript">
//<!--
$('#multiquote_link_1262').css("display", "");
// -->
</script>
<!-- end: postbit_multiquote --><!-- start: postbit_report -->
<a href="javascript:void(0)" onclick="Report.reportPost(1262); return false;" title="Anmäl detta inlägg till moderatorn" class="postbit_report"><span>Anmäl</span></a>
<!-- end: postbit_report -->
</div>
</div>
<!-- end: postbit -->
</body>
</html>
<!-- end: showthread -->
- - -
It's the "
<div id="tyl_btn_1262" class="postbit_buttons">" that make the button come a line above.
By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.
Either the <div> element has to be removed or a change is needed with CSS. Since the surrounding buttons haven't go the <div> element it might be better to not have it there at all. Or use the <span> element instead:
<span> is an inline-level element, whereas a <div> is a block-level element.
(
https://stackoverflow.com/questions/3576...-after-div)
The next task will be to figure out where this <div> element is generated.
I believe it comes from the
function thankyoulike_install() in thankyoulike.php and where the <div> element is put into an array named "$tyl_templates = array(" and then read into the table named "templates" in the database.
I think I found it. Row 449 and 450 in thankyoulike.php
'thankyoulike_button_add' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"add_tyl_button\" href=\"thankyoulike.php?action=add&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.add({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->add_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->add_tyl}</span></a></div>",
'thankyoulike_button_del' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"del_tyl_button\" href=\"thankyoulike.php?action=del&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.del({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->del_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->del_tyl}</span></a></div>",
I can delete the two <div> elements in the
function thankyoulike_install(), but I believe that will only affect the database when the plugin is not already installed. What to do when I don't want to loose the likes that's been made already?
* * *
The magnifying icon comes with
class="del_tyl_button", in this case where a "Thank you" already is given. The task will be to find out where this class comes from. Since there's no css-file for this plugin, then I think it might be stored in the database.
When the plugin is installed then the "a.add_tyl_button span{" and the "a.del_tyl_button span{" are stored in an array called "$css = array("
// css-class for thankyoulike
$css = array(
"name" => "thankyoulike.css",
"tid" => 1,
"attachedto" => "showthread.php",
"stylesheet" => "div[id^=tyl_btn_] {
display: inline-block;
}
a.add_tyl_button span{
background-image: url(images/thankyoulike/tyl_add.png);
background-repeat: no-repeat;
font-weight: bold;
}
a.del_tyl_button span{
background-image: url(images/thankyoulike/tyl_del.png);
background-repeat: no-repeat;
font-weight: normal;
}
.tyllist{
background-color: #f5f5f5;
border-top: 1px dotted #ccc;
border-bottom: 1px dotted #ccc;
padding: 2px 5px;
}
.tyllist_classic{
background-color: #f5f5f5;
border-top: 1px dotted #ccc;
border-bottom: 1px dotted #ccc;
padding: 2px 5px;
}
img[id^=tyl_i_expcol_]{
vertical-align: bottom;
}
.popular_post{
border: 2px solid;
border-radius: 3px;
border-color: rgba(112,202,47,0.5);
background-color: rgba(139,195,74,0.3);
}",
"cachefile" => $db->escape_string(str_replace('/', '', thankyoulike.css)),
"lastmodified" => TIME_NOW
);
Then the array seams to be read into the table "themestylesheets" in the database:
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
$sid = $db->insert_query("themestylesheets", $css);
$db->update_query("themestylesheets", array("cachefile" => "css.php?stylesheet=".$sid), "sid = '".$sid."'", 1);
$tids = $db->simple_select("themes", "tid");
while($theme = $db->fetch_array($tids))
{
update_theme_stylesheet_list($theme['tid']);
}
$cache->update_usergroups();
$cache->update_forums();
$cache->update_tasks();
I'm sorry if it's a bit messy, but I'm trying to structure my thoughts. Hopefully, someone can give a helping hand
(2017-12-23, 05:30 PM)Sokrates Wrote: (2017-12-15, 05:13 PM)Sokrates Wrote: It looks like the thankyoulike.css stylesheet is attached to the showthread.php file, but it's added / modified through themes. Should the code be added/modified through showthread.css or global.css?
I had a look at thankyoulike.php an it looks like it's the function thankyoulike_install() that creates thankyoulike.css.
// Insert Template elements
$templateset = array(
"prefix" => "thankyoulike",
"title" => "Thank You/Like",
);
$db->insert_query("templategroups", $templateset);
$tyl_templates = array(
'thankyoulike_postbit' => "<div class=\"post_controls tyllist {\$unapproved_shade}\">
{\$tyl_expcol}
<span id=\"tyl_title_{\$post['pid']}\" style=\"{\$tyl_title_display}\">{\$lang->tyl_title}</span><span id=\"tyl_title_collapsed_{\$post['pid']}\" style=\"{\$tyl_title_display_collapsed}\">{\$lang->tyl_title_collapsed}</span><br />
<span id=\"tyl_data_{\$post['pid']}\" style=\"{\$tyl_data_display}\"> • {\$post['thankyoulike']}</span>
</div>",
'thankyoulike_postbit_classic' => "<div class=\"post_controls tyllist_classic {\$unapproved_shade}\">
{\$tyl_expcol}
<span id=\"tyl_title_{\$post['pid']}\" style=\"{\$tyl_title_display}\">{\$lang->tyl_title}</span><span id=\"tyl_title_collapsed_{\$post['pid']}\" style=\"{\$tyl_title_display_collapsed}\">{\$lang->tyl_title_collapsed}</span><br />
<span id=\"tyl_data_{\$post['pid']}\" style=\"{\$tyl_data_display}\"> • {\$post['thankyoulike']}</span>
</div>",
'thankyoulike_expcollapse' => "<a href=\"javascript:void(0)\" onclick=\"thankyoulike.tgl({\$post['pid']});return false;\" title=\"{\$tyl_showhide}\" id=\"tyl_a_expcol_{\$post['pid']}\"><img src=\"{\$theme['imgdir']}/{\$tyl_expcolimg}\" alt=\"{\$tyl_showhide}\" id=\"tyl_i_expcol_{\$post['pid']}\" /></a> ",
'thankyoulike_button_add' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"add_tyl_button\" href=\"thankyoulike.php?action=add&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.add({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->add_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->add_tyl}</span></a></div>",
'thankyoulike_button_del' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"del_tyl_button\" href=\"thankyoulike.php?action=del&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.del({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->del_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->del_tyl}</span></a></div>",
'thankyoulike_users' => "<span class=\"smalltext\">{\$comma}</span><a href=\"{\$profile_link}\" class=\"smalltext\" {\$datedisplay_title}>{\$tyl_list}</a>{\$datedisplay_next}",
'thankyoulike_postbit_author_user' => "{\$lang->tyl_rcvd}: {\$post['tyl_unumrtyls']}
<br />
{\$lang->tyl_given}: {\$post['tyl_unumtyls']}",
'thankyoulike_member_profile' => "<tr>
<td class=\"trow1\"><strong>{\$lang->tyl_total_tyls_rcvd}</strong></td>
<td class=\"trow1\">{\$memprofile['tyl_unumrcvtyls']} ({\$tylrcvpd_percent_total})<br /><span class=\"smalltext\">(<a href=\"tylsearch.php?action=usertylforthreads&uid={\$uid}\">{\$lang->tyl_find_threads_for}</a> — <a href=\"tylsearch.php?action=usertylforposts&uid={\$uid}\">{\$lang->tyl_find_posts_for}</a>)</span></td>
</tr>
<tr>
<td class=\"trow2\"><strong>{\$lang->tyl_total_tyls_given}</strong></td>
<td class=\"trow2\">{\$memprofile['tyl_unumtyls']} ({\$tylpd_percent_total})<br /><span class=\"smalltext\">(<a href=\"tylsearch.php?action=usertylthreads&uid={\$uid}\">{\$lang->tyl_find_threads}</a> — <a href=\"tylsearch.php?action=usertylposts&uid={\$uid}\">{\$lang->tyl_find_posts}</a>)</span></td>
</tr>"
);
foreach($tyl_templates as $template_title => $template_data)
{
$insert_templates = array(
'title' => $db->escape_string($template_title),
'template' => $db->escape_string($template_data),
'sid' => "-2",
'version' => $info['intver'],
'dateline' => TIME_NOW
);
$db->insert_query('templates', $insert_templates);
}
// css-class for thankyoulike
$css = array(
"name" => "thankyoulike.css",
"tid" => 1,
"attachedto" => "showthread.php",
"stylesheet" => "div[id^=tyl_btn_] {
display: inline-block;
}
It seams that the templates are inserted to the database, which make sense. I guess the malfunction is due what is stored in some fields in the database.
I looked into the html-code that comes to the web browser. This is a simplified version:
- - -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!-- start: showthread -->
<html xml:lang="sv" lang="sv" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme2/global.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/star_ratings.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/showthread.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/cache/themes/theme1/css3.css" />
<link type="text/css" rel="stylesheet" href="http://campingforum.net/ncode/xpserkan.css" />
</head>
<body>
<div class="post_controls">
<div class="postbit_buttons author_buttons float_left">
<!-- start: postbit_pm -->
<a href="private.php?action=send&uid=2" title="Send this user a private message" class="postbit_pm"><span>PM</span></a>
<!-- end: postbit_pm --><!-- start: postbit_www -->
<a href="http://manssonslatadagar.blogspot.se/" target="_blank" rel="noopener" title="Visit this user's website" class="postbit_website"><span>Webbplats</span></a>
<!-- end: postbit_www --><!-- start: postbit_find -->
<a href="search.php?action=finduser&uid=2" title="Find all posts by this user" class="postbit_find"><span>Hitta</span></a>
<!-- end: postbit_find --><!-- start: postbit_rep_button -->
<a href="javascript:void(0)" onclick="MyBB.reputation(2,1262); return false;" title="Give Reputation to this user" class="postbit_reputation_add"><span>Betygsätt</span></a>
<!-- end: postbit_rep_button -->
</div>
<div class="postbit_buttons post_management_buttons float_right">
<!-- start: thankyoulike_button_del -->
<div id="tyl_btn_1262" class="postbit_buttons"><a class="del_tyl_button" href="thankyoulike.php?action=del&pid=1262&my_post_key=185975bba8a0d13c8be182cd1fbb2399" onclick="thankyoulike.del(1262, 319); return false;" title="Ta bort tack skall du ha från detta inlägg" id="tyl_a1262"><span id="tyl_i1262">Ta bort tack</span></a></div>
<!-- end: thankyoulike_button_del --><!-- start: postbit_quote -->
<a href="newreply.php?tid=319&replyto=1262" title="Quote this message in a reply" class="postbit_quote"><span>Svara</span></a>
<!-- end: postbit_quote --><!-- start: postbit_multiquote -->
<a href="javascript:void(0)" onclick="Thread.multiQuote(1262); return false;" style="display: none;" id="multiquote_link_1262" title="Quote this post" class="postbit_multiquote"><span id="multiquote_1262">Citera</span></a>
<script type="text/javascript">
//<!--
$('#multiquote_link_1262').css("display", "");
// -->
</script>
<!-- end: postbit_multiquote --><!-- start: postbit_report -->
<a href="javascript:void(0)" onclick="Report.reportPost(1262); return false;" title="Anmäl detta inlägg till moderatorn" class="postbit_report"><span>Anmäl</span></a>
<!-- end: postbit_report -->
</div>
</div>
<!-- end: postbit -->
</body>
</html>
<!-- end: showthread -->
- - -
It's the "<div id="tyl_btn_1262" class="postbit_buttons">" that make the button come a line above.
By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.
Either the <div> element has to be removed or a change is needed with CSS. Since the surrounding buttons haven't go the <div> element it might be better to not have it there at all. Or use the <span> element instead:
<span> is an inline-level element, whereas a <div> is a block-level element.
(https://stackoverflow.com/questions/3576...-after-div)
The next task will be to figure out where this <div> element is generated.
I believe it comes from the function thankyoulike_install() in thankyoulike.php and where the <div> element is put into an array named "$tyl_templates = array(" and then read into the table named "templates" in the database.
I think I found it. Row 449 and 450 in thankyoulike.php
'thankyoulike_button_add' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"add_tyl_button\" href=\"thankyoulike.php?action=add&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.add({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->add_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->add_tyl}</span></a></div>",
'thankyoulike_button_del' => "<div id=\"tyl_btn_{\$post['pid']}\" class=\"postbit_buttons\"><a class=\"del_tyl_button\" href=\"thankyoulike.php?action=del&pid={\$post['pid']}&my_post_key={\$mybb->post_code}\" onclick=\"thankyoulike.del({\$post['pid']}, {\$post['tid']}); return false;\" title=\"{\$lang->del_tyl_button_title}\" id=\"tyl_a{\$post['pid']}\"><span id=\"tyl_i{\$post['pid']}\">{\$lang->del_tyl}</span></a></div>",
I can delete the two <div> elements in the function thankyoulike_install(), but I believe that will only affect the database when the plugin is not already installed. What to do when I don't want to loose the likes that's been made already?
Maybe I found an easier way by editing Edit Template: thankyoulike_button_add
It seams to have done the job! The "ThankYouLike button" is now inline.
* * *
The magnifying icon comes with class="del_tyl_button", in this case where a "Thank you" already is given. The task will be to find out where this class comes from. Since there's no css-file for this plugin, then I think it might be stored in the database.
When the plugin is installed then the "a.add_tyl_button span{" and the "a.del_tyl_button span{" are stored in an array called "$css = array("
// css-class for thankyoulike
$css = array(
"name" => "thankyoulike.css",
"tid" => 1,
"attachedto" => "showthread.php",
"stylesheet" => "div[id^=tyl_btn_] {
display: inline-block;
}
a.add_tyl_button span{
background-image: url(images/thankyoulike/tyl_add.png);
background-repeat: no-repeat;
font-weight: bold;
}
a.del_tyl_button span{
background-image: url(images/thankyoulike/tyl_del.png);
background-repeat: no-repeat;
font-weight: normal;
}
.tyllist{
background-color: #f5f5f5;
border-top: 1px dotted #ccc;
border-bottom: 1px dotted #ccc;
padding: 2px 5px;
}
.tyllist_classic{
background-color: #f5f5f5;
border-top: 1px dotted #ccc;
border-bottom: 1px dotted #ccc;
padding: 2px 5px;
}
img[id^=tyl_i_expcol_]{
vertical-align: bottom;
}
.popular_post{
border: 2px solid;
border-radius: 3px;
border-color: rgba(112,202,47,0.5);
background-color: rgba(139,195,74,0.3);
}",
"cachefile" => $db->escape_string(str_replace('/', '', thankyoulike.css)),
"lastmodified" => TIME_NOW
);
A stupid question: Why is there an "a." infront of "a.add_tyl_button span{" and "a.del_tyl_button span{"?
Then the array seams to be read into the table "themestylesheets" in the database:
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
$sid = $db->insert_query("themestylesheets", $css);
$db->update_query("themestylesheets", array("cachefile" => "css.php?stylesheet=".$sid), "sid = '".$sid."'", 1);
$tids = $db->simple_select("themes", "tid");
while($theme = $db->fetch_array($tids))
{
update_theme_stylesheet_list($theme['tid']);
}
$cache->update_usergroups();
$cache->update_forums();
$cache->update_tasks();
I tested to see what happen if I just added the following code to global.css:
a.add_tyl_button span{
background-image: url(images/thankyoulike/tyl_add.png);
background-repeat: no-repeat;
font-weight: bold;
}
a.del_tyl_button span{
background-image: url(images/thankyoulike/tyl_del.png);
background-repeat: no-repeat;
font-weight: normal;
}
It didn't help. Not even after clearing cached images and files. I've restored it to default again.
I realized that one maybe should have edited global.css from the admin CP instead of editing the file itself. Now it did the jobb!
The "ThankYouLike" button is now inline with the other buttons and the right images are shown. Keeping my fingers that the problem has been solved!
It became a bit messy in my previous post.
This is how I solved the problem:
It's the "<div id="tyl_btn_1262" class="postbit_buttons">" that make the button come a line above.
By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS.
Either the <div> element has to be removed or a change is needed with CSS. Since the surrounding buttons haven't go the <div> element it might be better to not have it there at all.
The <div> elements origin are at rows 449 and 450 in the function thankyoulike_install() in thankyoulike.php file.
I used the admin CP to remove the two <div> elements in: Edit Template: thankyoulike_button_add. I also removed the corresponding two <div> elemens in the thankyoulike.php file at rows 449 and 450, but I believe that only will have an impact when the plugin is installed the first time without being installed earlier.
Removing the <div> elements made the "ThankYouLike" button come in the right place.
For getting the right images on the "ThankYouLike" button
I copied the following code and added it to global.css from the admin CP :
a.add_tyl_button span{
background-image: url(images/thankyoulike/tyl_add.png);
background-repeat: no-repeat;
font-weight: bold;
}
a.del_tyl_button span{
background-image: url(images/thankyoulike/tyl_del.png);
background-repeat: no-repeat;
font-weight: normal;
}
This solved the problem and now the button has got the right image.