Commit 4df95eaa authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Add workaround for extra blogs that are hidden via old data etc (bug #942239)"

parents 0479b883 8f5cd413
......@@ -93,7 +93,10 @@ $elements['accountoptionsdesc'] = array(
$elements = array_merge($elements, general_account_prefs_form_elements($prefs));
// If the user doesn't have exactly one blog, don't show the multipleblogs option.
$elements['multipleblogs']['ignore'] = count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) != 1;
$blogcount = count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) ;
if ($blogcount != 1 && $prefs->multipleblogs == 1) {
$elements['multipleblogs']['ignore'] = true;
}
$elements['submit'] = array(
'type' => 'submit',
......
......@@ -146,3 +146,4 @@ $string['feedsnotavailable'] = 'Feeds are not available for this artefact type.'
$string['feedrights'] = 'Copyright %s.';
$string['enablemultipleblogstext'] = 'You have one journal. If you would like to start a second one, enable the multiple journals option on the <a href="%saccount/">account settings</a> page.';
$string['hiddenblogsnotification'] = 'Additional journal(s) have been made for you, but your account does not have the multiple journals option. You can set that on the <a href="%saccount/">account settings</a> page.';
......@@ -33,6 +33,9 @@ addLoadEvent(function() {literal}{{/literal}
{if $enablemultipleblogstext}
<p class="s dull center">{str tag=enablemultipleblogstext section=artefact.blog arg1=$WWWROOT}</p>
{/if}
{if $hiddenblogsnotification}
<p class="s dull center">{str tag=hiddenblogsnotification section=artefact.blog arg1=$WWWROOT}</p>
{/if}
</div>
{include file="footer.tpl"}
......@@ -103,9 +103,14 @@ $smarty = smarty(array('paginator'));
$smarty->assign('PAGEHEADING', $blog->get('title'));
$smarty->assign('INLINEJAVASCRIPT', $js);
if (!$USER->get_account_preference('multipleblogs')
&& count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) == 1) {
$smarty->assign('enablemultipleblogstext', 1);
if (!$USER->get_account_preference('multipleblogs')) {
$blogcount = count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id'));
if ($blogcount == 1) {
$smarty->assign('enablemultipleblogstext', 1);
}
else if ($blogcount > 1) {
$smarty->assign('hiddenblogsnotification', 1);
}
}
$smarty->assign_by_ref('blog', $blog);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment