Calling tainacan_the_metadata function outside the loop

Ok, we need to investigate this. What about a var_dump to tainacan_get_collection? Or, since you are obtaining the collection ID from the current post type, tainacan_the_collection_name($my_collection_id)?

Ok, now I got it. I believe what does the trick for the CSV exposer is this line:

Can you try putting the same logic in your exposer? It should be in your rest_request_after_callbacks function. I would also advise adding the file formar as in line 45 up there.

Dear Mateus:

I have just seen that there is a new version of Tainacan. Can you confirm that this version resolves the issue about the sections title that we discussed in December and for which you sent me a version of the plugin?

Unfortunately, your two suggestions did not work. When including these lines in the template,

           >  //Post's collection id
            //$collection = tainacan_get_collection_id();
            $collection = get_post_type();
            preg_match('/\d+/', $collection, $matches);
            $collection_id = $matches[0];

            //Post's collection name
            $collection_name = tainacan_the_collection_name($collection_id);

the $collection-name variable returns an empty string.

And when adding these lines to the rest_request_after_callbacks function,

    >  public function rest_request_after_callbacks( $response, $handler, $request ) {
        $response->set_headers( ['Content-Type: text/plain; charset=' . get_option( 'blog_charset' )] );

        $filename .= 'funes.ris';
    
        header('Content-Disposition: attachment; filename="'.$filename.'"');

I still get a new page with string coming from the $response variable, instead of having the browser download a file with it.

Best regards,

                    Pedro

Dear Mateus:

It is always better to let things rest overnight. I managed to solve the download issue with what looks as the same code I was using yesterday:

        $response->set_headers( ['Content-Type: text/plain; charset=' . get_option( 'blog_charset' )] );
         
        //Set to download
        $filename = 'Funes.ris';
        header('Content-Disposition: attachment; filename="'.$filename.'"');

Thank you again for your help.

I have seen that tainacan is not available in Wordpress plugins. Is there anything we should be worried?

Best regards,

                    Pedro

That is some true right there :rofl:

Don’t worry, it was a temporary Download removal as it was found a way of accessing the import and export log files without some capabilities check… WordPress is pretty rigorous about its hosted plugins once they start getting more users and sometimes we end up finding this breaches. We already fixed the issue yesterday and are awaiting their review, which tends to last one to three days. Hopefully all should be back to normal soon :crossed_fingers:.


About your code being “not efficient” or “messy”. I do enjoy that you could learn a lot in the process, even being a bit of a headache, it is important that other contributors start putting their hands on code. I really cannot offer a more detailed review of these requests because we’ve been overloaded with demands that impact all users (the security review aforementioned being one of them). But hopefully, as your usage increase, you can find more time to mature the code. We often launch things one way and later discover better ways to do it.

The ideal path, in my opinion is that one day you can convert your plugin into an actual plugin for the repository. We could think of strategies to parameterize all those metadata in a way that it can work for other collections or even other citation standards. It is surely something that other users could benefit from :heart:

Dear Mateus:

Thank you for your comments. In our first email conversation early in December 2023, you told me that Tainacan was not a “swiz-knife” solution for every problem. Anyway, I liked so much the plugin, knowing that it was not designed for bibliographic repositories. The view and the exposers in my plugin cover the basic needs for that purpose that were not available in Tainacan. The only issue remaining is the authors’ order. I had to add a field to register the authors in the proper order.

I will switch now my work on adding several other collections we have in queue.

My final concern now is going from staging to production. We are having big problems doing that given the size of database: 2 Gb. I have seen some forum messages concerning this, but my IT department is a little bit mind closed.

I hope, one day, we can offer the plugin to other users needing to implement a bibliographic repository.

Best regards,

                    Pedro
1 curtida

Este tópico foi fechado automaticamente 60 dias depois da última resposta. Novas respostas não são mais permitidas.