All of my members are not happy with the text sizing options currently available. They have to change the text size every time they change chapters or stories.
They would like a way to set the text size in the [Edit Preferences] screen that way their story text size will always be the same. Not sure if this is a possibility but I would have a LOT of happy members if so.
Hi Jennmc75! Do you mean readers want a different size? Or authors?
If ALL of your readers want the larger text size, I would recommend changing the default text size is your skin's CSS file.
eFiction Archives:
This intrigued me since I figured my members would like it as well. I know that a number of them use the +text size option when viewing stories, and you're right, they would prefer not to have to hit the button when they begin/change stories. I came up with a way to change the default text size for the whole site. I figured that if they needed bigger story text, then they needed it all over when browsing the entire site. You could change things to just change story text, if that's all you want. This requires quite a few edits, and there's probably an easier way to do it since I'm not a professional, but it works :biggrin: .
First, in the SQL box of your database, enter this to save the text size preference. It defaults all current and new users to the normal size:
ALTER TABLE `fanfiction_authorprefs` ADD `sitetextsize` tinyint(1) NOT NULL default '0';
Next, open includes/pagesetup.php. After:
unset($catresult, $result, $classresults, $classtyperesults, $ratlist, $type, $rate, $class, $char, $cat);
$action = escapestring($action);
Add: (if a user is logged in, the site checks what their default text size is. If they aren't logged in, they get the default size)
if(USERUID) {
$textpref = dbquery("SELECT sitetextsize FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '".USERUID."'");
list($sitetextsize) = dbrow($textpref);}
else $sitetextsize = 0;
Find:
if($action != "printable") $tpl->newBlock("header");
After it, add:
$tpl->assign("sitetextsize", "style='font-size: ".(100 + ($sitetextsize * 20))."%;'");
Next, open your header.tpl file. If you have more than one skin, each skin may have its own header.tpl file located in the skin folder. If that's the case, you need to edit them all for this to work on all your skins. If your skins don't have their own tpl files, you just need to edit the one in the default_tpls folder. Find:
<div id="mainpage">
Change it to:
<div id="mainpage" {sitetextsize}>
Finally, open user/editprefs.php to make the section where users can select their default text size. After:
$sortby = isset($_POST['sortby']) && $_POST['sortby'] == 1 ? 1 : 0;
Add:
$text = isset($_POST['text']) && isNumber($_POST['text']) ? $_POST['text'] : 0;
Change:
dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET alertson = '$useralertson', newreviews = '$newreviews', newrespond = '$newrespond', ageconsent = '$ageconsent', tinyMCE ='$tinyMCE', userskin = '$skinnew', storyindex = '$storyindex', banner = '$showbanners', sortby = '$sortby' WHERE uid = '".USERUID."'");
To:
dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET sitetextsize = '$text', alertson = '$useralertson', newreviews = '$newreviews', newrespond = '$newrespond', ageconsent = '$ageconsent', tinyMCE ='$tinyMCE', userskin = '$skinnew', storyindex = '$storyindex', banner = '$showbanners', sortby = '$sortby' WHERE uid = '".USERUID."'");
Then, after:
$output .= "<label for='tinyMCE'>"._USETINYMCE.":</label> <INPUT name="tinyMCE" type="checkbox" class="checkbox"".($user['tinyMCE'] ? " checked" : "")."><A HREF=""#"" class="pophelp">[?]<span>"._HELP_TINYMCE."</span></A><br />";
Add:
$output .= "Text size: <input type="radio" class="radio" id="normtext" value="0" name="text"".(empty($user['sitetextsize']) || $user['sitetextsize'] == 0 ? "checked='checked'" : "")."><label for="normtext">Normal </label><input type="radio" class="radio" id="medtext" value="1" name="text"".(!empty($user['sitetextsize']) && $user['sitetextsize'] == 1 ? "checked='checked'" : "")."><label for="medtext">Medium </label><input type="radio" class="radio" id="largetext" value="2" name="text"".(!empty($user['sitetextsize']) && $user['sitetextsize'] == 2 ? "checked='checked'" : "")."><label for="largetext">Large</label></span><br />";
Hope this helps!
Wow, thanks for that suggestion.
I don't know if every user would like the text to be larger. I just know I've had a handful of members suggest text size be an option they can set and not have to go back to unless they want to.
I think I'll post a poll and see if they are happy with me increasing the general text size on the site and go from there.
Thanks again for all of the hard work you are putting into the new programming π
So, life has been crazy and I'm just now getting around to adding this code to my site. I did all of the edits suggested. The text size preference appears just fine in the edit preferences page. However, when I choose my text size and click submit I get the following error:
A fatal MySQL error was encountered.
Query: UPDATE allfanfiction_authorprefs SET sitetextsize = '1', alertson = '1', newreviews = '1', newrespond = '1', ageconsent = '1', tinyMCE ='1', userskin = 'TWCS', storyindex = '0', banner = '', sortby = '1' WHERE uid = '1'
Error: ()
I'm not sure how what went wrong.
Would it be possible to set a default text size for all stories in the coding in the storyblock.php file listed in the Includes folder?
I'm sorry to ask so many questions but I'm not very knowledgeable in programming language so any help anyone here can give is appreciated more than you could ever know π
UPDATE:
I found it and fixed it. I used the Viewstory.php file and made the following edits:
Find:
if(isset($_GET['textsize']) && isNumber($_GET['textsize'])) $textsize = $_GET['textsize'];
else $textsize = 0;
I changed the 0 for the textsize to 10 and it only increased the font on the view story pages. I'm so excited that I worked through it and figured it all out π
