Commit 8f5cd413 authored by Melissa Draper's avatar Melissa Draper

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

While commit 0af8ce9e makes it so new copied
journals etc shouldn't get lost, there are accounts that had copied journals
from before commit 5e07db54 went into effect,
and are now hence hidden. This new commit works around that so that the option
to enable multiblogs is visible if it is somehow disabled for someone with
multiple journals, rather than just being ignored for everyone with multiple
journals. A discreet notice has been placed on /artefact/blog/view/ so that
the user knows.

Change-Id: I6d65aa934d3f3368083e55b21a30fb00d5a0c132
parent a9c42fc6
......@@ -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',
......
......@@ -144,3 +144,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"}
......@@ -94,9 +94,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);
......
Markdown is supported
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