Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin development – please can you help


  • Ashwani
    Participant

    @ashwanim

    Hi Friends,

    I have recently started plugin development for Buddypress. I have fair knowledge of PHP and understand basics of Plugin development. Please can you help me with certain queries below:

    1. Can you give me any link to good ebook for Buddypress plugin development?
    2. I understand using action hooks I can call my own function, but how can say that call my function after or before the action hook. e.g. I want to display new fields / text in User profile page so I’m attaching my function in action hook ‘xprofile_template_loop_end’, but this writes all the fields and ‘Save’ button and then calls my function so my fields/text comes after ‘Save’ button.
    3. How can I know in my function (to take appropriate action) the current selected option by user. e.g. action hook ‘xprofile_template_loop_end’ can be called in display and edit profile, how can I know in my function that it is edit or just display?
    4. How can I add new fields on a page and database thru plugin and not manually editing the page?

    Appreciate your help.

    thanks & regards,
    Ashwani

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

  • LPH2005
    Participant

    @lph2005

    Others will be more specific with you but here is an important link.

    BuddyPress Codex


    Roger Coathup
    Participant

    @rogercoathup

    @ashwanim

    Ok, that’s very advanced level stuff – some quick answers below – BUT, please post your xprofile questions as separate threads – and give a better indication of the problem in the title (“plugin development – please help” is way too general, and unfortunately likely lead to your question being overlooked).

    1. I don’t know of any book on BuddyPress plugin development – unfortunately, the codex as @lph2005 points out, is the best starting point, but it’s nowhere near developed enough to handle the questions you are asking re: xprofile_template_loop_end

    2. Unless a core developer / xprofile expert can step in here, I don’t know of a better solution than tracking through the code and seeing if an earlier hook is called (and for 3. whether there is anything in the data structure passed to the hook that gives a more specific activity type). Ask these as separate threads.

    4. We’ve done some work on this – if you post as a separate thread – I’ll dig through our work at the weekend, and see if I can post some pointers


    Anonymous User 96400
    Inactive

    @anonymized-96400

    Well, when yo call xprofile_template_loop_end, then this hook should only run once the complete loop has finished. There’s no way of adding stuff before or after a certain action hook (except when there’s another hook), only right where the hook is. One way of adding things to a loop is to use a counter for the loop and then add a dynamic hook to every entry, like so:
    `do_action( ‘some_custom_hook_’. $counter );`

    BuddyPress plugins are just WordPress plugins, so the best starting point is probably the WP codex:
    https://codex.wordpress.org/Main_Page

    Then there’s the skeleton component that does a pretty good job of explaining some BP specific stuff:
    https://wordpress.org/extend/plugins/buddypress-skeleton-component/

    And of course the BP plugin files and other BP plugins, that you can have a look through.


    Ashwani
    Participant

    @ashwanim

    Hi Friends,

    thank you for your replies. As per Roger’s suggestions I have created another post with title ‘Plugin development — xprofile questions’.

    regards,
    Ashwani

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin development – please can you help’ is closed to new replies.
Skip to toolbar