Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting Buddypress Functions in to Custom Theme

  • Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla, @mercime, @boonebgorges, @DJPaul @r-a-y, Hello, I use a custom theme with buddypress. I need some assistance on getting the functions to work! For example, on the profiles, after the “@%username%”, with the little question mark, normally, the “@% is a unique identifier for % that you can type into any message on this site. % will be sent a notification and a link to your message any time you use it.” does not function, along with some other issues.

    When I put the functions.php from the buddypress default theme into my theme’s functions.php, and it solves the problem, but I get fatal error after fatal error after fatal error on a ton of things.

    How do I get the functions into my theme safely so these fatal errors don’t occur?

Viewing 18 replies - 1 through 18 (of 18 total)
  • Don’t copy over BP Default’s functions.php into your child theme. Just start out by writing your custom function into a new file labeled function.php.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    You shouldn’t need to copy over anything from bp-default functions.php as that will cause a ‘cannot re-declare’ error notice. it sounds as though you have separated yourself from bp-default including the javascript files, it’s probably best to run a child that still references the functions and javascript files just copy over any folders and if necessary the css folder and change your styles.css @import paths to reference the local folder.

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla Just put the functions from the default theme in a file in my themes folder? If I label is bp-functions.php, how can I call it in my functions.php in my theme?

    I researched that, and tried some codes, but all of them cause more fatal errors.

    I am sort of lost on what you are talking about.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Unless there is good reason you shouldn’t need to worry about functions.php or at least you can create your own functions.php in your theme root and in that add your own unique functions. It’s as Michael says earlier don’t copy any of the default functions, if you have created a child theme correctly you will inherit that file as well as being able to run your own one in child theme just as long as you don’t try and declare or call the same function twice

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla, but the functions are not working, so I am missing something, but what?

    If I don’t do anything with the buddypress functions, what do I do to add the functions?

    P.S, I really appreciate the help hnla :)

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    You do not need to do anything or at least shouldn’t. A child theme inherits everything from the parent until the point that you copy a file over to the child theme, however certain files are called regardless functions.php and the global.js files are called regardless. To start with do not do anything with your own custom functions file, leave that until things are working correctly. The mention earlier of the @mentions dropdown sounds like a JS issue not a functions file one so I wonder how you’ve set up the child theme. To actually confirm the base install works please activate bp-default and confirm things work.

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla,I do not really know If I am using a bp child theme, here is what I did to make everything work.

    Installed Custom Theme (arras theme)
    Installed BP, and BP-template pack
    In the theme’s user.css I made a call to the bp-default theme’s css so all of the css and Ajax would work. (success)

    I have all of the files into my arras theme (activity, groups, forums, etc)

    Is that a child theme? :s

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    It’s a child theme if the style.css or primary stylesheet that must live in theme root has ‘Template: bp-default’ sitting amongst the other details at the top, not sure how things work with these template pack conversions as I don’t use it, either creating a child theme from scratch or full theme.

    I’m guessing everything works correctly if you tried the default bp theme, so not sure what’s wrong.

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla,really, the only thing wrong is the “@% is a unique identifier for % that you can type into any message on this site. % will be sent a notification and a link to your message any time you use it.”

    All I need to know is how to get that working.

    Thanks so much! :)

    Avatar of Virtuali
    Virtuali
    Participant

    @gunju2221

    Sounds like you need to add the JS into the file in your theme.

    Avatar of luvs
    luvs
    Member

    @luvs123

    What file?

    @hnla?

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    The javascript main file ‘global.js and also the ajax file are both included and enqueued from the main functions file in bp-default so I don’t really know why it isn’t working for you other than your child theme isn’t correctly referencing bp-default and that might be the fault of the custom theme?

    you could try adding:
    `
    // Load the AJAX functions for the theme
    require_once( TEMPLATEPATH . ‘/_inc/ajax.php’ );

    // Load the javascript for the theme
    wp_enqueue_script( ‘dtheme-ajax-js’, get_template_directory_uri() . ‘/_inc/global.js’, array( ‘jquery’ ) );
    `
    to your functions file in child theme and copying over the two files into ‘_inc’ folder of child theme and see if that works.

    Avatar of @mercime
    @mercime
    Keymaster

    @mercime

    @luvs123 Not sure where you are in getting Arras theme compatible with BuddyPress. But you might want to look at this Arras Child theme with BuddyPress templates installed and configured – http://durkkooistra.com/brownbuddy/
    You might want to style the fonts smaller in the sidebar, but that’s not a deal-breaker :-)
    Good luck.

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla, the files are already there, and the code is already there.

    AAARRRRG. :(

    @mercime, thanks, but I like the real arras theme :)

    P.S, I have another problem lurking in the shadows….. I cannot ban members from groups. (kick and ban) “There was an error when banning the user”

    If anything could go wrong, it will! :)

    Avatar of luvs
    luvs
    Member

    @luvs123

    bump

    Ok for future references, here is exactly what I did for my arras theme, And so far, it’s pretty good.

    1. Installed Arras + Buddypress.
    2. Installed Buddypress Template Pack
    3. Called the Buddypress Stylesheets into my theme (/* Inherit the default theme styles */
    @import url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/default.css ); Put that into Arras Custom.css
    4. Deleted the CSS from template pack, did not need anymore (following step 3)

    Everything is dandy except functions. I am missing a step… but where?

    @hnla, @mercime, @boonebgorges, @r-a-y, @djpaul

    Avatar of luvs
    luvs
    Member

    @luvs123

    Oh, and brownbuddy theme has a worse intigration than my theme!

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Glad you got it all working. You sorted the issue with the functions file, which seemed the main thrust of the thread ?

    Avatar of luvs
    luvs
    Member

    @luvs123

    @hnla, no, I did not get it working? :0

    BrownBuddy has the same problem as me, but brownbuddy is even worse when it comes to intigrated.

    The steps I listed on the top of the thread got everything working except functions….

    Such as…..

    The dropdown bubble “%is a unique identifier for %…..”
    And the friend request accept is broken, because functions are not listed.

    The code to get this working is listed in bp-default theme’s functions:

    `/* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
    function bp_dtheme_js_terms() { ?>

    var bp_terms_my_favs = ”;
    var bp_terms_accepted = ”;
    var bp_terms_rejected = ”;
    var bp_terms_show_all_comments = ”;
    var bp_terms_show_all = ”;
    var bp_terms_comments = ”;
    var bp_terms_close = ”;
    var bp_terms_mention_explain = ”;

    <?php
    }`

    But Where do I put it so it gets working?

    Putting it in Arras’s functions.php does the trick, but gets too many errors to even function on the site…

Viewing 18 replies - 1 through 18 (of 18 total)

You must be logged in to reply to this topic.