1

(23 replies, posted in PunBB 1.4 additions)

They are great! Hell, it's so good to know that somebody develops something for PunBB smile My regards, I think I'm gonna use them in my forums after some adjustments.

2

(5 replies, posted in PunBB 1.4 troubleshooting)

keeshii wrote:
Gregoric wrote:

The pun_pm extension required a fix as well;

Just remove #e modifier from this method, it is not needed. The code should looks like this:

$str1 = preg_replace('#^Re\[(\d{1,10})\]: #u', '\'Re[\'.(\\1 + 1).\']: \'', $str);

Okay, thank you a bunch!

3

(5 replies, posted in PunBB 1.4 troubleshooting)

The pun_pm extension required a fix as well;
http://punbb.informer.com/forums/post/147488/#p147488

Could you provide any tips or links to solutions so I could fix it on my own? The code in the file looks like this:

{
    if (substr($str, 0, 4) == 'Re: ')
        return 'Re[2]: ' . substr($str, 4);
    $str1 = preg_replace('#^Re\[(\d{1,10})\]: #eu', '\'Re[\'.(\\1 + 1).\']: \'', $str);
    return $str == $str1 ? 'Re: ' . $str : $str1;
}
Visman wrote:

Gregoric, why on the page two jQuery boot?

...
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
...
<script>
    $LAB.setOptions({AlwaysPreserveOrder:false})
    .script("//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js").wait();
</script>
</body>
</html>

I had declared jQuery twice, as I did not know how to add custom JS code back then (and I have coded it into the main.tpl template file). Since I made some research about LAB.js (thanks to your pointing out that jQuery is loading twice in my case) I am now able to use my custom JS files properly smile

After removing double jQuery, the addon did returned lack of jQuery lib loaded and so I have added such line to the footer.php so that the addon JS code loads after the LABjs loads jQuery library.

$forum_loader->add_js($base_url.'/extensions/om_markitup/js/jquery.markitup-1.1.13.js');

Now the extension works just fine!

When tring to use the extension, such an error is reported in the console when accessing new post page:

TypeError: $(...).markItUp is not a function 2:266

How should I fix this one or what could it possibly be caused by?

The problems I had mentioned above are solved already.

I do have another question. How do I create a valid MySQL query? I have an external file with PHP code and I have added this code today so that I could edit some data in the database but it seems not to work.

if (!defined('FORUM_ROOT'))
          define('FORUM_ROOT', './');
      require FORUM_ROOT.'include/common.php';

        $query = array(
            'UPDATE'    => 'users',
            'SET'        => 'avatar=\'2\', avatar_height=\'125\', avatar_width=\'125\'',
            'WHERE'        => 'id='.$id
        );
        $forum_db->query_build($query) or error(__FILE__, __LINE__);

When the code is to be executed I get 'CSRF token mismatch' error. What should I do so that I could do a MySQL call from my own code? I would really appreciate help!

keeshii wrote:

There is a function for deleting an user's avatar in include/functions.php, it is called delete_avatar(). This function is visible globally, so you can use it anywhere in your addon. Setting an avatar will be a little more complicated, because there is no function for such action, you will have to write this code yourself. It is not complicated, you just need to upload file into avatar directory and then run a simple update on table users. You should analyze the file profile.php lines 1079 - 1220, there is the code responsible for setting an avatar.

If you need any help, just ask. I will be glad to help you with coding smile

Thank you, I will surely consult you smile


At the moment I have another problem.

I have been working on the interface of my project and moved some project files to different directories. One of them was my .php file that is responsible for executing script. Previously, it had been in root/awatar folder and now I have moved it to root/img/avatars. Is the access to this directory denied with htaccess somehow? I cannot submit form to this location, nor I can simply view the file. I am using folder based (fancy) rewriting, if that matters.
Edit: I have solved this problem by moving the php file with code to root directory, but I would still appreciate answer, just to know.

And another two quick questions: is there a variable somewhere in common.php or anywhere else that stores just the base forum url? Secondly, is it possible to create some redirect rule that would redirect user from /avatar to /user/[$id]/avatar/ ?

Thanks in advance

Hello!


At the moment I am developing a simple addon that allows my forum users to generate avatars based on some data. I would like to add some code that would automatically resize the generated image to a specified size and set it as the user's avatar on the forums - no matter whether the user already has or does not have an avatar.

If user already has uploaded avatar, it is easy to change it to the newly generated one but since I have seen some data regarding avatar in the MySQL database, I suppose it is a bit trickier to write code that would set the avatar for a use that does not have one, am I right?

Could you give me little advice what code should I use? I got overwhelmed by the CMS's code when tried to find required pieces. I am strictly interested in how to set an image as user's avatar (I can handle uploading, resizing with imagick).


Regards,
Gregoric

keeshii wrote:

This is the forum for punbb 1.3 wink For 1.4.2 check these extensions:

Thank you! The k_fields addon is the thing that I had searched for. It made a bit of problems (forum sites did not want to display) but after reinstallation of the addon everything works fine smile

Thank you, regards!

keeshii wrote:

Are you looking for an extension for punbb 1.3? You may try this out: http://punbb.informer.com/forums/topic/ … r-profile/

Unfortunately, I am running 1.4.2 and the addon seems not ot be supported. Thanks for suggestion, tho!

Edit: sorry, I have just noticed the post is located in 1.3 category. I have googled it and so I did not notice that fact.

If that is not a big problem, I would like to bump the thread as well. I would love to see such a feature in PunBB. If someone would supply with a link or simple description of how to add (or remove) custom fields in profile pages, that would be great!

Regards,
Gregoric