MyBB Community Forums

Full Version: MyAlerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
You have to take the HTML code for the modal out of the myalerts_headericon template. So this:

<div id="myalerts_alerts_modal" style="display: none;">
    <table class="tborder" cellspacing="0">
        <thead>
        <tr>
            <th class="thead" colspan="2">
                <strong>{$lang->myalerts_page_title}</strong>
            </th>
        </tr>
        </thead>
        <tbody>
        {$alerts}
        </tbody>
        <tr>
            <td class="tfoot smalltext" colspan="2">
                <a href="{$mybb->settings['bburl']}/alerts.php">{$lang->myalerts_usercp_nav_alerts}</a>
                <span class="float_right">
                    <a href="{$mybb->settings['bburl']}/alerts.php?action=delete_all&amp;my_post_key={$mybb->post_code}&amp;ret_link={$myalerts_return_link}"
                       onclick="return confirm('{$lang->myalerts_delete_all_confirm}')">{$lang->myalerts_usercp_nav_delete_all}</a>
                </span>
                <br class="clear"/>
                <!-- Clear alerts link goes here... -->
            </td>
        </tr>
    </table>
</div>

I personally put mine in the footer so it doesn't interfere with my theme when it opens.

Your myalerts_headericon should look like this:
<li class="alerts {$newAlertsIndicator}">
    <a href="{$mybb->settings['bburl']}/usercp.php?action=alerts" class="myalerts open_modal"
       data-selector="#myalerts_alerts_modal" rel="modal:open">{$lang->myalerts_alerts}
        ({$mybb->user['unreadAlerts']})</a>
</li>
PM'd you Euan, I have a problem with posting on the forum now with myalerts intalled
(2015-01-09, 02:22 PM)RVP991 Wrote: [ -> ]PM'd you Euan, I have a problem with posting on the forum now with myalerts intalled

Replied.

For others, this is a known issue since the latest commit that is caused by the alert types cache being out of date. I will be making a new commit this weekend to fix this issue. In the meantime, it would be best to disable the dev version of MyAlerts.

@others regarding <myalerts_headericon>: are you using the 2.0.0 version? If so, that variable is gone now and a proper PHP variable is used thanks to a new hook in MyBB 1.8.
This script for myalerts that is in the headerincludes templates absolutely hates my text editor.  If it is included my text editor disappears.  Remove it and my text editor is there.  Any suggestions?

<script type="text/javascript">
    var unreadAlerts = {$mybb->user['unreadAlerts']};
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/myalerts.js"></script>

This is the whole headerinclude template
<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css' />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1800"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1800"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1800"></script>
<script type="text/javascript" src="images/revolution/jquery-ui.js"></script>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
 <script type="text/javascript" src="{$mybb->asset_url}/jscripts/mood.js?ver=1800"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='http://code.jquery.com/jquery-1.7.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript">
    var unreadAlerts = {$mybb->user['unreadAlerts']};
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/myalerts.js"></script>
{$stylesheets}
{$myprofile_headerinclude}
<script type="text/javascript">
 
<!--
 lang.unknown_error = "{$lang->unknown_error}";

 lang.select2_match = "{$lang->select2_match}";
 lang.select2_matches = "{$lang->select2_matches}";
 lang.select2_nomatches = "{$lang->select2_nomatches}";
 lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
 lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
 lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
 lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
 lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
 lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
 lang.select2_loadmore = "{$lang->select2_loadmore}";
 lang.select2_searching = "{$lang->select2_searching}";

 var cookieDomain = "{$mybb->settings['cookiedomain']}";
 var cookiePath = "{$mybb->settings['cookiepath']}";
 var cookiePrefix = "{$mybb->settings['cookieprefix']}";
 var deleteevent_confirm = "{$lang->deleteevent_confirm}";
 var removeattach_confirm = "{$lang->removeattach_confirm}";
 var loading_text = '{$lang->ajax_loading}';
 var saving_changes = '{$lang->saving_changes}';
 var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
 var my_post_key = "{$mybb->post_code}";
 var rootpath = "{$mybb->settings['bburl']}";
 var imagepath = "{$theme['imgdir']}";
   var yes_confirm = "{$lang->yes}";
 var no_confirm = "{$lang->no}";
 var MyBBEditor = null;
 var spinner_image = "{$theme['imgdir']}/spinner.gif";
 var spinner = "<img src='" + spinner_image +"' alt='' />";
// -->
  
</script>
Hi,

That's odd. I don't use the editor, so I never noticed this. Could you try using the following instead?

<script type="text/javascript">
<!--
   var unreadAlerts = {$mybb->user['unreadAlerts']};
// -->
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/myalerts.js"></script>
(2015-01-10, 08:05 PM)Euan T Wrote: [ -> ]Hi,

That's odd. I don't use the editor, so I never noticed this. Could you try using the following instead?


<script type="text/javascript">
<!--
   var unreadAlerts = {$mybb->user['unreadAlerts']};
// -->
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/myalerts.js"></script>

That does not work. Same behavior. Editor shows up whenever I remove that bit from the header.
(2015-01-09, 01:57 AM)jshort Wrote: [ -> ]
(2015-01-09, 01:39 AM)ashkir Wrote: [ -> ]I apologize. I'm going to Google how to set a global variable! I never did that before! 

I don't think you're understanding...I gave you the line you need to change. In function myalerts_global_intermediate, you will see:

global $templates, $mybb, $lang, $myalerts_headericon;

Change it to:
global $templates, $mybb, $lang, $myalerts_headericon, $alerts;

I searched everywhere for myalerts_global_intermediate and didn't find it in any templates or the files. Where can I find that at? Or is this in the 2.0 version over the current github one?
(2015-01-10, 08:12 PM)user25 Wrote: [ -> ]
(2015-01-10, 08:05 PM)Euan T Wrote: [ -> ]Hi,

That's odd. I don't use the editor, so I never noticed this. Could you try using the following instead?



<script type="text/javascript">
<!--
   var unreadAlerts = {$mybb->user['unreadAlerts']};
// -->
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/myalerts.js"></script>

That does not work.  Same behavior. Editor shows up whenever I remove that bit from the header.

Hm. I'm not sure on that one. I'll have to look into it. Thanks for the report.

(2015-01-10, 08:47 PM)ashkir Wrote: [ -> ]
(2015-01-09, 01:57 AM)jshort Wrote: [ -> ]
(2015-01-09, 01:39 AM)ashkir Wrote: [ -> ]I apologize. I'm going to Google how to set a global variable! I never did that before! 

I don't think you're understanding...I gave you the line you need to change. In function myalerts_global_intermediate, you will see:

global $templates, $mybb, $lang, $myalerts_headericon;

Change it to:
global $templates, $mybb, $lang, $myalerts_headericon, $alerts;

I searched everywhere for myalerts_global_intermediate and didn't find it in any templates or the files. Where can I find that at? Or is this in the 2.0 version over the current github one?

Are you using 2.0.0? If so, it should be in the main plugin (inc/plugins/myalerts.php), it's a plugin hook. Try just searching for "global_intermediate", it's the function right after the hook.
Is there a way to have alerts checked by default on alerts settings page?
Hi,

If you go to the plugin listing page in the ACP, there is a link to force enable all alerts for all users.