Attempting to update customstyle plugin to 1.12

I'm not a coder. I would like to offer memberrs of our site  the ability to add style to their profile pages.

I haven't been successful in previous attempts to combine/update plugins, so I'm starting over by attempting to update ColdTrick's customstyle plugin from working on elgg 1.7 to working on elgg 1.12. There are about 5 lines of code that will throw a fatal error. I haven't been able to figure out how to change the lines of code.

I'm hoping someone here can/will tell me how one or more of the lines should be written.

1.

/set_page_owner($_SESSION['user']->getGUID());

2.

$current_user = $_SESSION['user']->getGUID();

3..

$customstyle_object = $user->getObjects($metadata_name, 1, 0);

4.

$customstyle_object = $current_user_entity->getObjects("customstylebackground", 1, 0);

5.

$customstyle_object = $current_user_entity->getObjects("customstylecolors", 1, 0);

Thank you for any help you can give,

JT

  • set_page_owner($_SESSION['user']->getGUID());

    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());

    $current_user = $_SESSION['user']->getGUID();

    elgg_get_logged_in_user_guid();

    $customstyle_object = $user->getObjects($metadata_name, 1, 0);

    $customstyle_object = elgg_get_entities_from_metadata(array(
    
    'metadata_names' => $metadata_name,
    'metadata_owner_guid' => elgg_get_logged_in_user_guid(),
    'limit' => 1,
    
    ));

    $customstyle_object = $current_user_entity->getObjects("customstylebackground", 1, 0);

    $customstyle_object = elgg_get_entities(array( 'type' => 'object', 'subtupe' => 'customstylebackground', 'owner_guid' => elgg_get_logged_in_user_guid(),'limit' => 1 ));

    $customstyle_object = $current_user_entity->getObjects("customstylecolors", 1, 0);

    $customstyle_object = elgg_get_entities(array( 'type' => 'object', 'subtupe' => 'customstylecolors', 'owner_guid' => elgg_get_logged_in_user_guid(),'limit' => 1 ));

     

    I've not tested it with this plugin so use it at your own risk.

  • Thank you! Thank you!

    I'll go test it out and let you know what happens.

  • Thank you for the code. I'm getting a little closer to where I need to be.

    I did catch a typo in the last two sets of code you gave me. I'm pretty sure 'subtupe' should be 'subtype' (first line of each set of code).

     I also made some other changes for code that was deprecated according to the code diagnostic plugin. I also updated the menu to the newer style. There is still a few other changes that the code diagnostic plugin suggests but the suggested change causes a white page with no explanation, so I'm leaving those alone for the moment.

    At this point, when I click to save changes from either the background or colors editing pages, the changes are not saved and I get an error message: "The action file for customstyle/savecolors was not found" OR "The action file for customstyle/savebackground was not found". So, I'll be back with more questions as soon as I dig a little more.

    Thanks again for the code.

    JayT

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking