Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3rd party logic hooks for saving #156

Open
Zegnat opened this issue Nov 25, 2012 · 1 comment
Open

Add 3rd party logic hooks for saving #156

Zegnat opened this issue Nov 25, 2012 · 1 comment

Comments

@Zegnat
Copy link

Zegnat commented Nov 25, 2012

Putting this up for discussion here. What I would like to see added is for the theme.php file to be able to hook into the saving logic used. This way a theme can add extra form fields and save them to the RSS.

For instance, a theme author could add an email field to the new thread / reply form and then implement a way for this to be saved. A possible solution for threads could be to call a function between $rss->set() and file_put_contents that can be used much like the theme_custom function.

This could allow for something like this to be added to the theme.php file:

function new_thread_custom($rss) {
    if ( isset($_POST['email']) && !empty($_POST['email']) ) {
        $rss->setValue(
            // Create a valid RSS `author` field:
            '/rss/channel/item/author' => $_POST['email'] . '(' . NAME . ')'
        );
    }
}

Of course this is the easiest of examples. But even this offers several new possibilities to a theme author. It’s now easier to display Gravatars or to contact a poster if we are talking an intranet board

Something bigger could be people allowing for images to be uploaded and adding enclosure elements to publish these.

This will mean the theme author should be able to hook into the reading of the RSS file aswell, but I think that’s what issue #155 is for.

@Kroc
Copy link
Owner

Kroc commented Nov 29, 2012

Very interesting; had not thought about this at all.
I have been considering for a long time to unify saving through a single function that takes a SimpleXML object and outputs it. This way, it would be easy for a hook function to modify the SimpleXML object prior to it being written out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants