Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 31,401 through 31,425 (of 32,468 total)
  • Author
    Search Results
  • #53464
    davidbessler
    Member

    This is frustrating. Tell me why this simplest of all plugins does not work.

    <?php

    /*

    Plugin Name: Add something to the header

    Plugin URI: http://davidbessler.com

    Description: My first plugin

    Author: David Bessler

    Author URI: http://davidbessler.com

    Version: 1.0

    */

    function add_something_to_the_header (){

    echo "<!--Something I added-->n";

    }

    add_action ('bb_head' , 'add_something_to_the_header');

    ?>

    #53463
    ardentfrost
    Member

    There is no instructions on how to write plugins as far as I know. You just gotta do it like the rest of us: look through the code and figure out how it’s written. It’s not too hard and it’s written logically. You need to be able to either grep or search inside the files (there’s a way to search inside php files using windows search). If you want to look for hooks, look for add_action or add_filter and see where they all are. If you want to see how to use them, look through other plugins.

    And if you have specific questions, these forums are here and there are plenty of people who try to help :)

    #52802

    In reply to: Plugin: Summon user

    AphelionZ
    Participant

    I can’t begin to express how psyched I am that you did this! I really do think its a good idea and will help a lot of forums increase their activity.

    By the way, it worked without a hitch and i have it installed over at http://outletzine.org/forums now :)

    #53478
    davidbessler
    Member

    OK look at this:

    $forum_restrict_keys = array(

    "1" => "davidbessler,testman",

    "3" => "davidbessler,",

    );

    function forum_restrict_check_name() {

    global $bb_current_user,$forum_restrict_keys;

    if ($bb_current_user){

    $allowed = strpos($forum_restrict_keys[get_forum_id()], get_user_name( $bb_current_user->ID ));

    if ($allowed == "") {

    echo "[blocked]";

    add_filter( 'get_forum_name', 'forum_restrict_blank_name');

    } else {

    echo "[Not blocked]";

    }

    }

    }

    function forum_restrict_blank_name (){

    echo "";

    }

    add_action( 'get_forum_name', 'forum_restrict_check_name');

    ?>

    That puts [blocked] instead of the forum name in a forum that user is not allowed to see, and [not blocked] on a forum he is allowed to see. How do I get the forum name back in there instead of [not blocked]?

    #52899
    spencerp
    Member

    @nateolsen, I just added ALL 3 databases into ONE database, like such:

    database_name (holding all three)

    bb_forums

    bb_posts

    bb_privatemessages

    bb_tagged

    bb_tags

    bb_topicmeta

    bb_topics

    mw_archive

    mw_categorylinks

    mw_externallinks

    mw_filearchive

    mw_hitcounter

    mw_image

    mw_imagelinks

    mw_interwiki

    mw_ipblocks

    mw_job

    mw_langlinks

    mw_logging

    mw_math

    mw_objectcache

    mw_oldimage

    mw_page

    mw_pagelinks

    mw_querycache

    mw_querycachetwo

    mw_querycache_info

    mw_recentchanges

    mw_redirect

    mw_revision

    mw_searchindex

    mw_site_stats

    mw_templatelinks

    mw_text

    mw_trackbacks

    mw_transcache

    mw_user

    mw_user_groups

    mw_user_newtalk

    mw_watchlist

    sk2_blacklist

    wp_bad_behavior

    wp_bas_log

    wp_bas_os

    wp_bas_pages

    wp_bas_refer

    wp_bas_searches

    wp_bas_ua

    wp_bas_visitors

    wp_bbpress_post_options

    wp_bbpress_post_posts

    wp_categories

    wp_comments

    wp_link2cat

    wp_linkcategories

    wp_links

    wp_options

    wp_post2cat

    wp_post2tag

    wp_postmeta

    wp_posts

    wp_secureimage

    wp_sk2_logs

    wp_sk2_spams

    wp_tags

    wp_tag_synonyms

    wp_usermeta

    wp_users

    Of course, used the normal database prefix for each one specifically. ;) :) It was mentioned though, that for the mw_ ones, you didn’t have to use the “mw_” prefix for when trying to mesh with bbpress/WP.. but, to play it safe, I used the default “mw_” prefix anyway.. Choice is your’s really.. :) ;)

    @mozey, nice!! I’ll have to try that out sometime, well, when I get more time. ;) :) Thanks for tips and pointers! ;) :)

    spencerp

    #1257
    davidbessler
    Member

    I’m REALLY new at making plugins. Let’s start there.

    I’m looking to hide certain forums from a defined list of people. Or actually, I’m looking to only allow certain people to see certain forums. Anyway, I’m starting with just trying to make that happen on the front page. How do I “hijack” the page just at the point where it is about to spit out the forums on the front-page? I think this is what hooks are for right? So that I don’t need to actually edit my front-page.php?

    Basically what I am looking to do, is during the “foreach” loop in front-page.php, I want to compare the upcoming forum_id with a list of usernames in an array who are allowed to see that forum. If there’s a match, it shows the forum, if not, it doesn’t.

    The array looks like this:

    $forum_restriction_keys = array(

    "1" => "bob, sam, jim, jane",

    "3" = > "bob",

    );

    So, to start, I need the right hook.

    #53468
    Trent Adams
    Member

    I would just use the full path on the server:

    <?php include

    ('var/usr/www/yourdirectory/whatever.file'); ?>

    That should work shouldn’t it?

    Referencing this post

    Trent

    #53459
    davidbessler
    Member

    so:

    Function BlahBlah () {

    global $bb_current_user;

    $myName = get_user_name( $bb_current_user->ID );

    echo "Hello, my name is ".$myName;

    }

    Like that?

    Where can I find a list of all these variables and functions? Like how did the author of that plugin know there was such a thing as get_user_name()?

    #53299
    startribe
    Member

    Thanks Trent, I am still pushing along… I understand, those late nights get to me too.

    All the Best,

    Orion

    #1255
    startribe
    Member

    I am trying to use a call to navigate to the root directory in order to call on an include that is located in a directory outside of the bbPress directory.

    Is there anyone out there who could help me with a BB PHP command that will bounce me back to the root directory. I tried…

    <?php include('../../etc/etc'); ?> with out results.

    So, any suggestions or ideas would be greatly appreciated.

    All the Best,

    Orion

    #52898
    mozey
    Member

    On my setup, (different system, same concept),

    i used a centralized mysql table which contains a mesh of all of the variables of all systems!. The reason wy i did that is, some of these usertables contain information which would change the bahaviour of the software, such as roll, last login etc. SO its not a mater of authentication and session ONLY. You also need the other stuff!!!.

    i ALSO used a single portal for signup/signin. THIS SHOULD NOT BE SCARY (assuming that thinking does’nt hurt your brain). A good IDE will get everything done for you (search replace globally, find all instances of a function etc).

    I reccomend http://www.eclipse.org/downloads/ as an editor, and use PHP IDE as an ide ontop of eclipse. Be patiant, if you have’nt installed before, it could be a bit strang, but do take a better part of a weekend to figure out hw it works. TRUST ME, php will be your bizatch afterwards ;)

    #53455
    flaerpen
    Member

    Hehe, I’m blind! :P Sorry, just open poEdit and do what it says :P.

    #52897
    Nate
    Member

    Spencer, was just hoping for a quick clarification on all this: Did you use the same MySQL database for everything? In the thread here you use terms like “MediaWiki database” and “WP database,” but I’m wondering whether that actually just means the MediaWiki tables and the WP tables, all contained in one MySQL database. Do tell. :)

    Thanks,

    Nate

    #1253
    davidbessler
    Member

    I am trying to write a plugin … how do I refer to the currently logged in user’s name? I tried

    get_user_name( $user->ID )

    but I get “get_user requires a numerical ID” or something like that.

    #52425
    spencerp
    Member

    Awesome! Thanks a million SamBauers! ;) :)

    spencerp

    #1252
    flaerpen
    Member

    Hello, I have made my own template and the original gettext-objects in the code have been replaced. Therefore I need to rescan my files for the gettext-text so I can translate.

    The only problem is that I have been searching for days to find out how to do, but i can’t find anything interesting. I’ve tried poEdit but you can’t search in .php files for gettext-objects!

    how do i do? someone who can help me?

    #52831
    ardentfrost
    Member

    I was referring to scale. Unless it’s in the core, it’s too large to expect others to make their code friendly with your code. If you have a thousand plugin authors and 10% of them do that, it just seems unreasonable that the other 900 will add 100 different things to their code to be friendly with other plugins. And if those 10% each write multiple plugins that way, it’s even MORE things the other 900 have to add to all their plugins.

    It’s nothing against YOU, it’s just that you have to think about scale, and what you’re asking isn’t scalable.

    #53451
    ardentfrost
    Member

    I do this on my page. Code looks like this:

    <h1><a href="http://www.rayd.org/"><?php option('name'); ?></a></h1>

    #53298
    Trent Adams
    Member

    Looking back at the code I put, I must have been tired! Great to hear you got it going Orion!

    Trent

    #1250
    aircow33
    Member

    Hi all, currently the header.php will display the name of the forum as a link. And the link sends you back to whereever you set in your config.php the variable $bb->domain. Currenlty it is $bb->domain = ‘forums.prosperworldloans.com’;

    i dont want to change the domain variable because i think location of cookies and many other things use this variable. But i want to change the link in header.php to point to a different location, namely http://www.prosperworldloans.com

    The code in header.php looks like this

    <body id=”<?php bb_location(); ?>”>

    <div id=”wrapper”>

    <div id=”header”>

    <h1>“><?php bb_option(‘name’); ?></h1>

    <?php login_form(); ?>

    </div>

    <div id=”main”>

    <?php if ( is_bb_profile() ) profile_menu(); ?>

    and i changed it to

    <body id=”<?php bb_location(); ?>”>

    <div id=”wrapper”>

    <div id=”header”>

    <h1><?php bb_option(‘name’); ?></h1>

    <?php login_form(); ?>

    </div>

    <div id=”main”>

    <?php if ( is_bb_profile() ) profile_menu(); ?>

    However when i make this change the link actually becomes http://forums.prosperworldloans.com/http://www.prosperworldloans.com

    I have no idea why this is. i tried using php printf to print it out and it seems to work but screws up the layout of the following php login_form() command. Any help on this issue is greatly appreciated it is very frustrating.

    #53297
    startribe
    Member

    YES! I got it… I used this to get the correct path:

    <?php bb_option('uri'); ?>my-templates/images/victorylogo.gif

    Ahhhh, and sigh. Trent, thanks for helping with getting my gears going. Now if anyone else runs into a similar issue, they will have a solution.

    All the Best,

    Orion

    #53296
    startribe
    Member

    actually, I forgot to load the file, the result above was from playing with

    ‘<?php bb_location(); ?>’ and “image”.

    After trying your code Trent, I received no results for the designated area:

    src=""

    #53295
    startribe
    Member

    lol…

    yeah, any solution is good to start for me. The above produced:

    front-pageimages/victorylogo.gif

    I am editing the front-page.php, so I am not sure if it pulled that file name or I have a setting a bit off somewhere.

    Hmmm…. there has to be a way. I am getting the images to load through CSS, but for this particular image I would like to have it in the HTML content.

    So any more ideas or suggestions are welcome.

    -Orion

    #53294
    Trent Adams
    Member

    If you are trying to get victorylogo.gif, I would use:

    <?php $victorylogo = (bb_get_option('uri') . 'my-templates/images/victorylogo.gif'); ?>

    <?php echo $stylesheet; ?>

    There might be an easier way, but I am a ‘may not be pretty, but works’ type of guy….

    Trent

    #53293
    startribe
    Member

    Hey Trent,

    Thanks for the reply…

    I checked out the source of the resulting page and found this…

    /my-templates/style.cssimages/victorylogo.gif

    So I noticed that it is posting “style.css” in the path, which is throwing me off.

    Essentially, I am trying to get into my “my-templates” directory. I will look into your other solution. If you have any other ideas, I am open ears.

    Thanks,

    Orion

Viewing 25 results - 31,401 through 31,425 (of 32,468 total)
Skip to toolbar