51

(18 replies, posted in Feature requests)

PanBB.Ru wrote:

then upgrade or reinstall the extension hooks .
I checked and I have worked.

Attention! After reinstalling all thanks zeroed!
First , try to update the hooks .

Good luck  )

Thanks! I got it working now.

Something else I am trying to do is create a 'new post' feed for a sidebar in my forums. I've looked at the Punbb guide on how to do this but it is kind of vague in its interpretation.

Is there a simple way to do this?

52

(18 replies, posted in Feature requests)

PanBB.Ru wrote:

it is hook

       <hook id="vt_row_pre_display"><![CDATA[
            // List of thankers
            if ($cur_post['om_thanks_cache'] && $forum_config['o_om_thanks_show_post'] == '1')
            {
                $om_thanks_users = array();
                $om_thanks_more = 0;
                foreach ($cur_post['om_thanks_cache'] as $user_id => $username) {
                    $om_thanks_users[] = '<a href='.forum_link($forum_url['user'], $user_id).'>'.$username.'</a>';
                    
                    $om_thanks_more++;
                    if ($forum_config['o_om_thanks_max_thanks'] > 0 && $om_thanks_more >= $forum_config['o_om_thanks_max_thanks']) {
                        break;
                    }
                }
                $om_thanks_more = (count($cur_post['om_thanks_cache']) > $om_thanks_more ? count($cur_post['om_thanks_cache']) - $om_thanks_more : 0);

                $forum_page['post_options']['om_thanks'] = '<p class="post-om_thanks">'.$lang_om_thanks['Thankers'].': '.implode(', ', $om_thanks_users)
                    .($om_thanks_more ? ' '.sprintf($lang_om_thanks['and more'], $om_thanks_more) : '').'</p>';
            }
        ]]></hook>

replace to

        <hook id="vt_row_pre_post_actions_merge"><![CDATA[
            if ($cur_post['poster_id'] > 1 && $cur_post['om_thanks_count'] > 0 && $forum_config['o_om_thanks_show_profile'] == '1')
                $forum_page['post_actions']['om_thanks_count'] = '<li><span>'.$lang_om_thanks['Thanks count'].': <strong>'.forum_number_format($cur_post['om_thanks_count']).'</strong></span></li>';

            if (!$forum_user['is_guest'] && $cur_post['poster_id'] != $forum_user['id']) 
            {
                if (!array_key_exists($forum_user['id'], $cur_post['om_thanks_cache'])) 
                {
                    $forum_page['post_actions']['om_thanks'] = '<li><span><a href="'.forum_link($forum_url['om_thanks_add'], array($cur_post['id'], generate_form_token('om_thanks_add'.$cur_post['id'].$forum_user['id']))).'">'.$lang_om_thanks['Give thanks'].'</a></span></li>';
                } 
                else if ($forum_config['o_om_thanks_allow_take'] == '1') 
                {
                    $forum_page['post_actions']['om_thanks'] = '<li><span><a href="'.forum_link($forum_url['om_thanks_del'], array($cur_post['id'], generate_form_token('om_thanks_del'.$cur_post['id'].$forum_user['id']))).'">'.$lang_om_thanks['Take thanks'].'</a></span></li>';
                }
            }
        ]]></hook>

Hmmm....    this doesn't work. Nothing changes.

53

(18 replies, posted in Feature requests)

PanBB.Ru wrote:

outweigh the need to code on another hook.

that is, the hook is in charge of the output information in the signature.

Thanks for the response PanBB.Ru.

So the hooks give the relation to where it ends up on the post?

How do I identify the differences in the hooks as there are 3 separate instances in the XML?

54

(18 replies, posted in Feature requests)

BUMP

Still looking for some help on this one.

55

(18 replies, posted in Feature requests)

BUMP

Is anybody still hanging around these days?

56

(18 replies, posted in Feature requests)

Here is the XML -

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<extension engine="1.0">
    <id>om_thanks</id>
    <title>Thanks</title>
    <version>0.0.2</version>
    <description>Say "thanks" below intresting posts.</description>
    <author>om</author>

    <minversion>1.4RC1</minversion>
    <maxtestedon>1.4.2</maxtestedon>

    <install>
        $schema = array(
            'FIELDS' => array(
                'post_id' => array(
                    'datatype' => 'INT(10) UNSIGNED',
                    'allow_null' => false,
                    'default' => '0'
                ),
                'user_id' => array(
                    'datatype' => 'INT(10) UNSIGNED',
                    'allow_null' => false,
                    'default' => '0'
                ),
                'poster_id' => array(
                    'datatype' => 'INT(10) UNSIGNED',
                    'allow_null' => false,
                    'default' => '0'
                )
            ),
            'PRIMARY KEY' => array('post_id', 'user_id')
        );
        $forum_db->create_table('om_thanks', $schema);

        if(!$forum_db->field_exists('posts', 'om_thanks_cache'))
            $forum_db->add_field('posts', 'om_thanks_cache', 'TEXT', false, '');

        if(!$forum_db->field_exists('users', 'om_thanks_count'))
            $forum_db->add_field('users', 'om_thanks_count', 'INT', false, '0');

        // Required from version 0.0.2
        if(!$forum_db->field_exists('om_thanks', 'added'))
            $forum_db->add_field('om_thanks', 'added', 'INT(10) UNSIGNED', false, '0');

        // Add extension options to the config table
        $om_images_config = array(
            'o_om_thanks_show_profile' => '1', // true
            'o_om_thanks_show_post' => '1', // true
            'o_om_thanks_allow_take' => '1', // true
            'o_om_thanks_max_thanks' => '50',
        );

        foreach ($om_images_config as $conf_name => $conf_value) {
            forum_config_add($conf_name, $conf_value);
        }
    </install>

    <uninstall><![CDATA[
        $forum_db->drop_field('posts', 'om_thanks_cache');

        $forum_db->drop_field('users', 'om_thanks_count');

        $forum_db->drop_table('om_thanks');

        // Delete extension options from the config
        forum_config_remove(array(
            'o_om_thanks_show_profile',
            'o_om_thanks_show_post',
            'o_om_thanks_allow_take',
            'o_om_thanks_max_thanks',
        ));
    ]]></uninstall>

    <hooks>
        <hook id="vt_pre_header_load"><![CDATA[
            // Incuding styles for om_thanks
            if ($forum_user['style'] != 'Oxygen' && file_exists($ext_info['path'].'/css/'.$forum_user['style'].'/om_thanks.min.css'))
                $forum_loader->add_css($ext_info['url'].'/css/'.$forum_user['style'].'/om_thanks.min.css', array('type' => 'url', 'media' => 'screen'));
            else
                $forum_loader->add_css($ext_info['url'].'/css/Oxygen/om_thanks.min.css', array('type' => 'url', 'media' => 'screen'));
            
            if (!isset($lang_om_thanks)) {
                if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                else
                    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
            }
        ]]></hook>

        <hook id="vt_qr_get_posts"><![CDATA[
            $query['SELECT'] .= ', p.om_thanks_cache, u.om_thanks_count';
        ]]></hook>

        <hook id="vt_post_loop_start"><![CDATA[
            if ($cur_post['om_thanks_cache']) {
                $cur_post['om_thanks_cache'] = unserialize($cur_post['om_thanks_cache']);
            } else {
                $cur_post['om_thanks_cache'] = array();
            }
        ]]></hook>

        <hook id="vt_row_pre_post_actions_merge"><![CDATA[
            if ($cur_post['poster_id'] > 1 && $cur_post['om_thanks_count'] > 0 && $forum_config['o_om_thanks_show_profile'] == '1')
                $forum_page['author_info']['om_thanks_count'] = '<li><span>'.$lang_om_thanks['Thanks count'].': <strong>'.forum_number_format($cur_post['om_thanks_count']).'</strong></span></li>';

            if (!$forum_user['is_guest'] && $cur_post['poster_id'] != $forum_user['id']) {
                if (!array_key_exists($forum_user['id'], $cur_post['om_thanks_cache'])) {
                    $forum_page['author_info']['om_thanks'] = '<li><span><a href="'.forum_link($forum_url['om_thanks_add'], array($cur_post['id'], generate_form_token('om_thanks_add'.$cur_post['id'].$forum_user['id']))).'">'.$lang_om_thanks['Give thanks'].'</a></span></li>';
                } elseif ($forum_config['o_om_thanks_allow_take'] == '1') {
                    $forum_page['author_info']['om_thanks'] = '<li><span><a href="'.forum_link($forum_url['om_thanks_del'], array($cur_post['id'], generate_form_token('om_thanks_del'.$cur_post['id'].$forum_user['id']))).'">'.$lang_om_thanks['Take thanks'].'</a></span></li>';
                }
            }
        ]]></hook>
    
        <hook id="vt_row_pre_display"><![CDATA[
            // List of thankers
            if ($cur_post['om_thanks_cache'] && $forum_config['o_om_thanks_show_post'] == '1')
            {
                $om_thanks_users = array();
                $om_thanks_more = 0;
                foreach ($cur_post['om_thanks_cache'] as $user_id => $username) {
                    $om_thanks_users[] = '<a href='.forum_link($forum_url['user'], $user_id).'>'.$username.'</a>';
                    
                    $om_thanks_more++;
                    if ($forum_config['o_om_thanks_max_thanks'] > 0 && $om_thanks_more >= $forum_config['o_om_thanks_max_thanks']) {
                        break;
                    }
                }
                $om_thanks_more = (count($cur_post['om_thanks_cache']) > $om_thanks_more ? count($cur_post['om_thanks_cache']) - $om_thanks_more : 0);

                $forum_page['post_options']['om_thanks'] = '<p class="post-om_thanks">'.$lang_om_thanks['Thankers'].': '.implode(', ', $om_thanks_users)
                    .($om_thanks_more ? ' '.sprintf($lang_om_thanks['and more'], $om_thanks_more) : '').'</p>';
            }
        ]]></hook>

        <hook id="mi_new_action"><![CDATA[
            if (isset($_GET['om_thanks_add']))
            {
                if ($forum_user['is_guest'])
                    message($lang_common['No permission']);

                $post_id = intval($_GET['om_thanks_add']);
                if ($post_id < 1)
                    message($lang_common['Bad request']);

                // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
                // If it's in GET, we need to make sure it's valid.
                if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('om_thanks_add'.$post_id.$forum_user['id'])))
                    csrf_confirm_form();

                // Get poster id
                $query = array(
                    'SELECT'    => 'p.poster_id',
                    'FROM'        => 'posts AS p',
                    'WHERE'        => 'id = '.$post_id
                );
                ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_get_poster')) ? eval($hook) : null;
                $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                $poster_id = $forum_db->result($result);

                // don't thank yourself
                if ($poster_id == $forum_user['id'])
                    message($lang_common['Bad request']);

                if (!isset($lang_om_thanks)) {
                    if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                        include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                    else
                        include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
                }

                // Fetch some info about the forum
                $query = array(
                    'SELECT'    => 'COUNT(t.post_id)',
                    'FROM'        => 'om_thanks AS t',
                    'WHERE'        => 't.post_id = '.$post_id.' AND t.user_id='.$forum_user['id'],
                );

                ($hook = get_hook('mi_om_thanks_add_qr_get_count')) ? eval($hook) : null;
                $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                $om_thanks_count = $forum_db->result($result);
                if ($om_thanks_count)
                    message($lang_common['Bad request']);

                $query = array(
                    'INSERT'    => 'post_id, user_id, poster_id, added',
                    'INTO'        => 'om_thanks',
                    'VALUES'    => $post_id.', '.$forum_user['id'].', '.$poster_id.', '.time(),
                );
                ($hook = get_hook('mi_om_thanks_add_qr_add_thanks')) ? eval($hook) : null;
                $forum_db->query_build($query) or error(__FILE__, __LINE__);

                if (!defined('OM_THANKS_FUNCTION_LOADED')) {
                    require $ext_info['path'] . '/functions.php';
                }

                om_thanks_rebuild_post_cache($post_id);

                if ($poster_id > 1)
                    om_thanks_update_thanks_count($poster_id);

                redirect(forum_link($forum_url['post'], $post_id), $lang_om_thanks['Thanks added']);
            }

            elseif (isset($_GET['om_thanks_del']))
            {
                if ($forum_config['o_om_thanks_allow_take'] != '1' || $forum_user['is_guest'])
                    message($lang_common['No permission']);

                $post_id = intval($_GET['om_thanks_del']);
                if ($post_id < 1)
                    message($lang_common['Bad request']);

                // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
                // If it's in GET, we need to make sure it's valid.
                if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('om_thanks_del'.$post_id.$forum_user['id'])))
                    csrf_confirm_form();

                // Get poster id
                $query = array(
                    'SELECT'    => 'p.poster_id',
                    'FROM'        => 'posts AS p',
                    'WHERE'        => 'id = '.$post_id
                );
                ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_get_poster')) ? eval($hook) : null;
                $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                $poster_id = $forum_db->result($result);

                // don't thank yourself
                if ($poster_id == $forum_user['id'])
                    message($lang_common['Bad request']);

                if (!isset($lang_om_thanks)) {
                    if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                        include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                    else
                        include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
                }

                $query = array(
                    'DELETE'    => 'om_thanks',
                    'WHERE'        => 'post_id = '.$post_id.' AND user_id='.$forum_user['id'],
                );
                $forum_db->query_build($query) or error(__FILE__, __LINE__);

                if (!defined('OM_THANKS_FUNCTION_LOADED')) {
                    require $ext_info['path'] . '/functions.php';
                }

                om_thanks_rebuild_post_cache($post_id);

                if ($poster_id > 1)
                    om_thanks_update_thanks_count($poster_id);

                redirect(forum_link($forum_url['post'], $post_id), $lang_om_thanks['Thanks taken']);
            }
        ]]></hook>

        <hook id="pf_change_details_username_changed"><![CDATA[
            // don't forget to update thanks when username changed
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_rebuild_user_cache($id);
        ]]></hook>

        <hook id="fn_delete_user_qr_delete_user"><![CDATA[
            // don't forget to update thanks when deleting user
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_user($user_id);
        ]]></hook>

        <hook id="mr_confirm_delete_posts_qr_delete_posts"><![CDATA[
            // don't forget to remove thanks when deleting posts
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_post($posts);
        ]]></hook>
        
        <hook id="fn_delete_post_qr_delete_post"><![CDATA[
            // don't forget to remove thanks when deleting posts
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_post($post_id);
        ]]></hook>
        
        <hook id="mr_confirm_delete_topics_qr_get_deleted_posts"><![CDATA[
            // don't forget to remove thanks when deleting posts
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_topic($topics);
        ]]></hook>
        
        <hook id="ca_fn_prune_qr_prune_posts"><![CDATA[
            // don't forget to remove thanks when deleting posts
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_topic($topic_ids);
        ]]></hook>
        
        <hook id="fn_delete_topic_qr_delete_topic_posts"><![CDATA[
            // don't forget to remove thanks when deleting posts
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            om_thanks_delete_topic($topic_id);
        ]]></hook>

        <hook id="pf_change_details_about_pre_header_load, pf_view_details_pre_header_load"><![CDATA[
            // don't forget to update thanks when username changed
            if (!defined('OM_THANKS_FUNCTION_LOADED'))
                require $ext_info['path'] . '/functions.php';

            if (!isset($lang_om_thanks)) {
                if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                else
                    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
            }

            if ($forum_config['o_om_thanks_show_profile'] == '1')
                $forum_page['user_info']['om_thanks'] = '<li><span>'.$lang_om_thanks['Thanks count'].': <strong>'.forum_number_format($user['om_thanks_count']).'</strong></span></li>';

            if ($forum_config['o_om_thanks_show_profile'] == '1' && $forum_user['g_search'] == '1') {
                $forum_page['user_activity']['om_thanks'] = '<li><a href="'.forum_link($forum_url['search_om_thanks'], $id).'">'.sprintf($lang_om_thanks['View user thanks'], forum_htmlencode($user['username'])).'</a></li>';
            }
        ]]></hook>

        <hook id="aop_features_avatars_fieldset_end"><![CDATA[
            // forum settings

            // load language file
            if (!isset($lang_om_thanks))
            {
                if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                else
                    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
            }
                    
            $forum_page['group_count'] = $forum_page['item_count'] = 0;
?>
            <div class="content-head">
                <h2 class="hn"><span><?php echo $lang_om_thanks['Thanks settings'] ?></span></h2>
            </div>
            <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
                <legend class="group-legend"><span><?php echo $lang_om_thanks['Features title'] ?></span></legend>


                <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
                    <div class="sf-box text">
                        <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_om_thanks['Max thanks'] ?></span><small><?php echo $lang_om_thanks['Max thanks info'] ?></small></label><br />
                        <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[om_thanks_max_thanks]" size="6" maxlength="6" value="<?php echo $forum_config['o_om_thanks_max_thanks'] ?>" /></span>
                    </div>
                </div>

                <fieldset class="mf-set set<?php echo ++$forum_page['item_count'] ?>">
                    <legend><span><?php echo $lang_om_thanks['Additional options'] ?></span></legend>
                    <div class="mf-box">
                        <div class="mf-item">
                            <span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[om_thanks_show_profile]" value="1"<?php if ($forum_config['o_om_thanks_show_profile'] == '1') echo ' checked="checked"' ?> /></span>
                            <label for="fld<?php echo $forum_page['fld_count'] ?>"><?php echo $lang_om_thanks['Show profile'] ?></label>
                        </div>
                    </div>
                    <div class="mf-box">
                        <div class="mf-item">
                            <span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[om_thanks_show_post]" value="1"<?php if ($forum_config['o_om_thanks_show_post'] == '1') echo ' checked="checked"' ?> /></span>
                            <label for="fld<?php echo $forum_page['fld_count'] ?>"><?php echo $lang_om_thanks['Show post'] ?></label>
                        </div>
                    </div>
                    <div class="mf-box">
                        <div class="mf-item">
                            <span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[om_thanks_allow_take]" value="1"<?php if ($forum_config['o_om_thanks_allow_take'] == '1') echo ' checked="checked"' ?> /></span>
                            <label for="fld<?php echo $forum_page['fld_count'] ?>"><?php echo $lang_om_thanks['Allow take'] ?></label>
                        </div>
                    </div>
                </fieldset>
<?php ($hook = get_hook('om_thanks_aop_fieldset_end')) ? eval($hook) : null; ?>
            </fieldset>
            <?php
        ]]></hook>
    
        <hook id="sf_fn_no_search_results_start"><![CDATA[
            if ($action == 'om_thanks') {
                if (!isset($lang_om_thanks)) {
                    if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                        include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                    else
                        include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
                }
                message($lang_om_thanks['No user posts'], $forum_page['search_again'], $lang_search['Posts by user']);
                return true;
            }
        ]]></hook>

        <hook id="aop_features_validation"><![CDATA[
            // validate forum settings
            $form['om_thanks_max_thanks'] = (!isset($form['om_thanks_max_thanks']) || (int) $form['om_thanks_max_thanks'] <= 0) ? '0' : (string)(int) $form['om_thanks_max_thanks'];

            if (!isset($form['om_thanks_show_profile']) || $form['om_thanks_show_profile'] != '1')
                $form['om_thanks_show_profile'] = '0';

            if (!isset($form['om_thanks_show_post']) || $form['om_thanks_show_post'] != '1')
                $form['om_thanks_show_post'] = '0';

            if (!isset($form['om_thanks_allow_take']) || $form['om_thanks_allow_take'] != '1')
                $form['om_thanks_allow_take'] = '0';

            ($hook = get_hook('om_thanks_aop_validation_end')) ? eval($hook) : null;
        ]]></hook>

        <hook id="sf_fn_validate_actions_start"><![CDATA[
            // add om_thanks to valid search actions
            $valid_actions[] = 'om_thanks';
        ]]></hook>

        <hook id="se_additional_quicksearch_variables"><![CDATA[
            // default value for om_thanks search = one day
            if ($action == 'om_thanks') {
                $value = isset($_GET['user_id']) ? intval($_GET['user_id']) : 0;
                if ($value < 2)
                    message($lang_common['Bad request']);
            }
        ]]></hook>

        <hook id="sf_fn_generate_action_search_query_end"><![CDATA[
            // generate_action_search_query
            // show all posts made by our friends in the last day
            if ($action == 'om_thanks') {
                $query = array(
                    'SELECT'    => 'DISTINCT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, p.message, p.hide_smilies, t.id AS tid, t.poster, t.subject, t.first_post_id, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id, f.forum_name',
                    'FROM'        => 'posts AS p',
                    'JOINS'        => array(
                        array(
                            'INNER JOIN'    => 'topics AS t',
                            'ON'            => 't.id=p.topic_id'
                        ),
                        array(
                            'INNER JOIN'    => 'forums AS f',
                            'ON'            => 'f.id=t.forum_id'
                        ),
                        array(
                            'LEFT JOIN'        => 'forum_perms AS fp',
                            'ON'            => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
                        ),
                        array(
                            'INNER JOIN'        => 'om_thanks AS ot',
                            'ON'            => 'p.id=ot.post_id',
                        )
                    ),
                    'WHERE'        => '(fp.read_forum IS NULL OR fp.read_forum=1) AND ot.poster_id='.$value,
                    'ORDER BY'    => 'pposted DESC'
                );

                $url_type = $forum_url['search_om_thanks'];
                $search_id = $value;
                $show_as = 'posts';
                ($hook = get_hook('om_thanks_generate_action_qr_search')) ? eval($hook) : null;
            }
        ]]></hook>

        <hook id="sf_fn_generate_search_crumbs_start"><![CDATA[
            if ($action == 'om_thanks') {
                if (!isset($lang_om_thanks)) {
                    if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                        include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                    else
                        include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
                }

                $forum_page['crumbs'][] = sprintf($lang_om_thanks['Thanks by'], $search_set[0]['pposter']);
                $forum_page['items_info'] = generate_items_info($lang_search['Posts found'], ($forum_page['start_from'] + 1), $num_hits);
                $forum_page['main_head_options']['user_posts'] = '<span'.(empty($forum_page['main_head_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['search_user_posts'], $search_id).'">'.sprintf($lang_search['Posts by'], forum_htmlencode($search_set[0]['poster'])).'</a></span>';
                $forum_page['main_head_options']['defined_search'] = '<span'.(empty($forum_page['main_head_options']) ? ' class="first-item"' : '').'><a href="'.forum_link($forum_url['search']).'">'.$lang_search['User defined search'].'</a></span>';
                return true;
            }
        ]]></hook>

        <hook id="co_modify_url_scheme"><![CDATA[
            if ($forum_config['o_sef'] != 'Default' && file_exists($ext_info['path'].'/url/'.$forum_config['o_sef'].'.php'))
                require $ext_info['path'].'/url/'.$forum_config['o_sef'].'.php';
            else
                require $ext_info['path'].'/url/Default.php';

        ]]></hook>

        <hook id="re_rewrite_rules"><![CDATA[
            $forum_rewrite_rules['/^om_thanks_(add|del)[\/_-]?([0-9]+)[\/_-]?([a-z0-9]+)?(\.html?|\/)?$/i'] = 'misc.php?om_thanks_$1=$2&csrf_token=$3';
            $forum_rewrite_rules['/^search[\/_-]?(om_thanks)[\/_-]([0-9]+)(\.html?|\/)?$/i'] = 'search.php?action=om_thanks&user_id=$2';
            $forum_rewrite_rules['/^search[\/_-]?(om_thanks)[\/_-]([0-9]+)[\/_-]p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'] = 'search.php?action=om_thanks&user_id=$2&p=$4';

            ($hook = get_hook('om_thanks_after_rewrite_rules_set')) ? eval($hook) : null;
        ]]></hook>

    </hooks>
</extension>

57

(18 replies, posted in Feature requests)

Here is the PHP -

<?php
/**
 * om_thanks functions: database
 *
 * @copyright (C) 2014 PunBB
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package om_thanks
 */

if (!defined('FORUM'))
    die();

// refreshes thanks cache for given posts
function om_thanks_rebuild_post_cache($post_id)
{
    global $forum_db;

    ($hook = get_hook('om_thanks_fn_rebuild_cache_start')) ? eval($hook) : null;

    // Fetch list of thanks for these posts
    $query = array(
        'SELECT'    => 'u.id, u.username',
        'FROM'        => 'users AS u',
        'JOINS'        => array(
            array(
                'INNER JOIN'    => 'om_thanks AS t',
                'ON'            => 't.user_id=u.id'
            )
        ),
        'WHERE'        => 't.post_id = '.$post_id,
        'ORDER BY'    => 't.added DESC, t.post_id, t.user_id',
    );
    ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_get_users')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

    $post_cache = array();
    while (($cur_thank = $forum_db->fetch_assoc($result))) {
        $post_cache[$cur_thank['id']] = $cur_thank['username'];
    }

    // Update post cache one by one
    $query = array(
        'UPDATE'    => 'posts',
        'SET'        => 'om_thanks_cache = \''.$forum_db->escape(serialize($post_cache)).'\'',
        'WHERE'        => 'id = '.$post_id
    );
    ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_update_cache')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
}

// refreshes number of thanks of specified user
function om_thanks_update_thanks_count($poster_id)
{
    global $forum_db;

    if ($poster_id <= 1)
        return;

    // Count post with thanks
    $query = array(
        'SELECT'    => 'count(*)',
        'FROM'        => 'om_thanks AS t',
        'WHERE'        => 'poster_id='.$poster_id
    );
    ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_get_poster')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $thanks_count = $forum_db->result($result);

    // Update number of thanks for that user
    $query = array(
        'UPDATE'    => 'users',
        'SET'        => 'om_thanks_count = '.$thanks_count,
        'WHERE'        => 'id = '.$poster_id
    );
    ($hook = get_hook('om_thanks_fn_rebuild_cache_qr_update_user')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
}

// delete thanks together with posts
function om_thanks_delete_post($posts)
{
    global $forum_db;

    if (!is_array($posts)) {
        $posts = array($posts);
    }

    ($hook = get_hook('om_thanks_fn_delete_post_start')) ? eval($hook) : null;

    // Count post with thanks
    $query = array(
        'SELECT'    => 'poster_id',
        'FROM'        => 'om_thanks AS t',
        'WHERE'        => 'post_id IN ('.implode(',', $posts).')',
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $posters = array();
    while (($cur_thank = $forum_db->fetch_assoc($result))) {
        $posters[] = $cur_thank['poster_id'];
    }

    // Remove him/her from the online list (if they happen to be logged in)
    $query = array(
        'DELETE'    => 'om_thanks',
        'WHERE'        => 'post_id IN ('.implode(',', $posts).')'
    );

    ($hook = get_hook('om_thanks_fn_delete_post_qr_delete_post')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);

    foreach($posters as $poster_id) {
        om_thanks_update_thanks_count($poster_id);
    }
}

// delete thanks together with topics
function om_thanks_delete_topic($topics)
{
    global $forum_db;

    if (!is_array($topics)) {
        $topics = array($topics);
    }

    ($hook = get_hook('om_thanks_fn_delete_post_start')) ? eval($hook) : null;

    // Count post with thanks
    $query = array(
        'SELECT'    => 't.post_id, t.poster_id',
        'FROM'        => 'om_thanks AS t',
        'JOINS'        => array(
            array(
                'INNER JOIN'    => 'posts AS p',
                'ON'        => 't.post_id = p.id'
            )
        ),
        'WHERE'        => 'topic_id IN ('.implode(',', $topics).')',
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $posters = array();
    $posts = array();
    while (($cur_thank = $forum_db->fetch_assoc($result))) {
        $posters[$cur_thank['poster_id']] = $cur_thank['poster_id'];
        $posts[$cur_thank['post_id']] = $cur_thank['post_id'];
    }

    // Remove him/her from the online list (if they happen to be logged in)
    if ($posts) {
        $query = array(
            'DELETE'    => 'om_thanks',
            'WHERE'        => 'post_id IN ('.implode(',', $posts).')'
        );

        ($hook = get_hook('om_thanks_fn_delete_post_qr_delete_post')) ? eval($hook) : null;
        $forum_db->query_build($query) or error(__FILE__, __LINE__);
    }

    foreach($posters as $poster_id) {
        om_thanks_update_thanks_count($poster_id);
    }
}

// delete thanks together with users
function om_thanks_delete_user($user_id)
{
    global $forum_db;

    ($hook = get_hook('om_thanks_fn_delete_post_start')) ? eval($hook) : null;

    // Count post with thanks
    $query = array(
        'SELECT'    => 'post_id, poster_id',
        'FROM'        => 'om_thanks',
        'WHERE'        => 'user_id = '. $user_id,
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $posters = array();
        $posts = array();
    while (($cur_thank = $forum_db->fetch_assoc($result))) {
            $posts[$cur_thank['post_id']] = $cur_thank['post_id'];
        $posters[$cur_thank['poster_id']] = $cur_thank['poster_id'];
    }

    // Remove him/her from the online list (if they happen to be logged in)
    $query = array(
        'DELETE'    => 'om_thanks',
        'WHERE'        => 'user_id = '. $user_id,
    );

    ($hook = get_hook('om_thanks_fn_delete_post_qr_delete_post')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);

    foreach ($posts as $post_id) {
        om_thanks_rebuild_post_cache($post_id);
    }
    foreach ($posters as $poster_id) {
        om_thanks_update_thanks_count($poster_id);
    }
}

// handle nick change of user
function om_thanks_rebuild_user_cache($user_id)
{
    global $forum_db;

    ($hook = get_hook('om_thanks_fn_rebuild_user_start')) ? eval($hook) : null;

    // Find all posts made by this user
    $query = array(
        'SELECT'    => 'post_id',
        'FROM'        => 'om_thanks AS t',
        'WHERE'        => 'user_id='.$user_id
    );

    ($hook = get_hook('om_thanks_fn_rebuild_user_qr_get_user_posts')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    while ($cur_post = $forum_db->fetch_assoc($result))
    {
        om_thanks_rebuild_post_cache($cur_post['post_id']);
    }
}


define('OM_THANKS_FUNCTION_LOADED', 1);

58

(18 replies, posted in Feature requests)

I need some help with the 'Thanks' extension - http://punbb.informer.com/forums/topic/ … on-thanks/

I am looking to relocate where the option to thank a post is shown.

I want to move it from here -
http://s16.postimg.org/og2cg57j9/Screenshot_1.png


To here -
http://s2.postimg.org/tscybrc1l/Screenshot_2.png

This must be done through either the php or the XML file. I will post both.

59

(55 replies, posted in Discussions)

I have fixed this issue.

Anyone that needs help in recreating this, please post to this thread or PM me and I will gladly lend a hand.

60

(2 replies, posted in PunBB 1.4 troubleshooting)

peregilk wrote:

Hi,
I am trying to integrate PunBB into my website, and will need to create a new theme to be able to do this.

Are there any guides on how to create new themes?

It depends on exactly what is is you are trying to replicate.

Cab you provide a link to your site please?

BUMP

Sajad wrote:

Hello!
I am Sajad, and this is my first post in the PunBB's community forum.
I need the thanks's module for PunBB 1.4
and thanks.
Greetings.

http://punbb.informer.com/forums/topic/ … on-thanks/

63

(0 replies, posted in Discussions)

Is it possible to replace certain elements in punbb with images?

Change from this -

http://imgur.com/RSvGiiz.png

To this -

http://i.imgur.com/SSBrsgw.png

Any help would be greatly appreciated.

64

(55 replies, posted in Discussions)

KnownSyntax wrote:

Do you have any links to those websites/forums that are running PunBB with this done? I'm looking around and nothing seems to be going the correct way (as the way you would like I should say).

Eh this project is only in maintenance releases it seems, minus the big jump to mobile rendering really.

Here is a link to a forum that does this -

http://panbb.ru/forum/post255.html#p255

I understand that this may just be a maintenance release but it is still a big enough issue to warrant some kind of response to fix.

65

(2 replies, posted in PunBB 1.4 additions)

paulcambull wrote:

Kushi made a nice layout with a background for each individual forum.

Having this ability in a plugin for editing forums would make for a very unique and clean look, something that PunBB would have that not many forums if any would.

http://i.imgur.com/ijxHr.jpg

Another nice addition would be to have a logo or banner possibility for the categories. You would be able to make a clean and easy navigation for users with more visual cues like this.

Would anyone be interested in helping with this?

It would also be interesting to see if there would be away to add some advertising in between each category or better yet, the ability to select which categories to have advertising above them. Does anyone now a way to make this possible?

66

(55 replies, posted in Discussions)

I've seen a couple different people with this change through varying methods, one of which was a plugin by Kushi but for some reason no one seems to want to get involved with this.

I'm starting to have my doubts about this software moving forward.

It's a damn shame too. I think that the platform PunBB has is far and away the best forum software around and with just a few changes could be the most preferred internet forum available.

67

(55 replies, posted in Discussions)

KnownSyntax wrote:

Point out the issues if you can and I'll try to look over the code and tell you where to look at. From what it seems like, it should be just a format change if the resolution is that of a mobile device (on tablets it seems to run fine, but I agree on improvements even there).

Here is the view now -

http://s3.postimg.org/7noflnn2n/Screenshot_1.jpg

Here is what I would like -

http://s13.postimg.org/j9li2mjub/Screenshot_2.jpg

I cannot thank you enough for taking the time to discuss this with me.

Hopefully we can get some more people involved and work towards a solution.
smile

68

(55 replies, posted in Discussions)

I'm willing to do the work if someone can point me in the right direction.

It's more than just the CSS. All I need is a starting point and I will figure out the rest.

69

(55 replies, posted in Discussions)

paulcambull wrote:

BUMP

This is still a MAJOR issue with the new forum format that needs to be addressed immediately. I am willing to donate some $ to the cause if someone is willing to fix this issue.

Is there anyway to contact a developer for PunBB directly?

There is no conversation regarding the fix of this issue and it is causing major problems for all users of PunBB and it is driving mobile users away.

70

(55 replies, posted in Discussions)

BUMP

This is still a MAJOR issue with the new forum format that needs to be addressed immediately. I am willing to donate some $ to the cause if someone is willing to fix this issue.

71

(55 replies, posted in Discussions)

frederiklarsen wrote:

Hi Paul

Did you find a solution to this CSS problem or did you just hit a dead end? Would it require you to change the HTML to do the trick, or do you want to only do it using CSS?

I have run into a dead end.

There was an extension previously done by Kushi that achieves this but I have been able to contact him for assistance.

I believe there is probably more to it than just the CSS.

72

(55 replies, posted in Discussions)

BUMP

73

(55 replies, posted in Discussions)

paulcambull wrote:
paulcambull wrote:

Has anyone looked into solving this issue?

This is a MAJOR problem with the new mobile version and I can speak with confidence for everyone that uses PunBB that in the long run we will lose forum members without this being corrected.

This goes directly against one of the main reasons for choosing this software - ease of viewing for the user.

I hate to keep repeating this but this forum does not seem very active and this is a very important issue for the new forum format.

If anyone has any idea, a direction to point me in or some type of advice I am begging you to please post it.

I have a very active forum that gets extremely busy this time of year and this is an issue that needs resolved immediately.

Thank you in advance to anyone that can help with this issue.

74

(0 replies, posted in PunBB 1.4 bug reports)

When trying to approve new users I am getting a failure to connect to database notice.

Any help would be greatly appreciated.

75

(55 replies, posted in Discussions)

paulcambull wrote:

Has anyone looked into solving this issue?

This is a MAJOR problem with the new mobile version and I can speak with confidence for everyone that uses PunBB that in the long run we will lose forum members without this being corrected.

This goes directly against one of the main reasons for choosing this software - ease of viewing for the user.

I hate to keep repeating this but this forum does not seem very active and this is a very important issue for the new forum format.

If anyone has any idea, a direction to point me in or some type of advice I am begging you to please post it.

I have a very active forum that gets extremely busy this time of year and this is an issue that needs resolved immediately.

Thank you in advance to anyone that can help with this issue.