• Resolved jstead

    (@jstead)


    Hi,

    Just looking to see if its at all possible to access/change the permalink of an H5P item. This field looks to be hidden.

    We are using the .h5p files within wp-content/uploads/h5p/exports to create translatable content.json files, and the naming of these .h5p elements looks to be taking the permalink name. So our .h5p file names match some front end h5p element names that have been updated, having access to the permalink would be a great help.

    Thanks,
    Jason

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author icc0rz

    (@icc0rz)

    Hi,

    The direct URL to the file isn’t available to avoid people from copying it and using it in various places. The file isn’t generated until the content is viewed so there’s no guarantee that the link will work. Also, when content types are updated the file becomes invalid, containing the old version of the content and isn’t updated until the content is viewed again.

    The name of this file is stored in the slug field of the h5p_contents table in the database. The variable is generated from the original title of the content and does not update.

    Not sure if this is what you’re looking for?

    Thread Starter jstead

    (@jstead)

    Ok, I think its the slug we are after.

    Basically, when we change the Title of an H5P item, we would like to have the filename of the .h5p file found in /wp-content/uploads/h5p/exports to have the same name, so that when 30 elements are translated into 4 languages, we can easily match up the translated item with the the original in WordPress.

    Would we need to update the slug to do this? and can that only be done through the Database.

    Plugin Author icc0rz

    (@icc0rz)

    Yes, you could add a field for editing it but it would be gone when the plugin is updated.
    Perhaps it could be part of the official plugin but only revealed when enabling a special setting through wp-config.php, or for a certain role/permission.

    Alternatively, you could create a custom plugin with an overview page of the content titles, ids and slugs. And the possibility to edit them.

    Thread Starter jstead

    (@jstead)

    Would it be hard for me to manually add this in? Which file would I need to look at editing?

    Updating each time we update wouldn’t be bad, as its the kind of edit we would only do on occasions like this (moving from DEV to PROD) to clean up development names into production ready names. Once done and clean slated, we shouldn’t have to do it until another major dev update occurs.

    Plugin Author icc0rz

    (@icc0rz)

    The form is rendered by the admin/views/new-content.php file, so here you can add the extra field.
    The variables available in that file is set by the display_new_content_page() function.
    When saving the process_new_content() function will update the values in the database.

    Thread Starter jstead

    (@jstead)

    Think this is over my head. Found where I would want to add the code (within <div id=”titlediv”>, but the typical get_permalink $post_id etc don’t work here. Even grabbed the permalink code from core edit_new.php but it returned errors for the general WP $post variables etc.

    dont think I have enough experience to how its structured in this plugin.

    I even tried to find in the update function a way off having the permalink always update… not just on first creation, but cant seem to find its reference in the functions mentioned above.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘H5P item permalink field’ is closed to new replies.